Skip to content

Commit f0f5cfb

Browse files
authored
Merge pull request awsdocs#172 from adcreech/adcreech-powershelldeploymentpackage
Update Lambda Deployment Package in PowerShell
2 parents fcb1005 + 345a903 commit f0f5cfb

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

doc_source/powershell-devenv.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ To set up your development environment for writing PowerShell scripts, do the fo
1010

1111
```
1212
Install-Module AWSLambdaPSCore -Scope CurrentUser
13-
```
13+
```
14+
15+
1. **(Optional) Install AWS Tools for PowerShell**\. You can install either the modularized [AWS.Tools](https://docs.aws.amazon.com/powershell/latest/userguide/pstools-welcome.html#pwsh_structure_pstools) or single-module [AWSPowerShell.NetCore](https://docs.aws.amazon.com/powershell/latest/userguide/pstools-welcome.html#pwsh_structure_pscore) version in PowerShell Core 6\.0 to use the Lambda API within your PowerShell environment\. You can find installation instructions in [Installing the AWS Tools for PowerShell](https://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up.html)\.

doc_source/powershell-package.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,34 @@ To create a new PowerShell script, upload it, and test it, follow this procedure
7272
```
7373

7474
Note that the `-Name` parameter specifies the Lambda function name, which appears in the Lambda console\. You can use this function to invoke your script manually\.
75+
76+
1. Invoke your function using the [AWS Tools for PowerShell](https://docs.aws.amazon.com/powershell/latest/userguide) `Invoke-LMFunction` cmdlet\.
77+
78+
```
79+
# Invoke function
80+
$response = Invoke-LMFunction -FunctionName MyFirstPSScript
81+
82+
# Read response payload
83+
$reader = New-Object -TypeName 'System.IO.StreamReader' -ArgumentList $response.Payload
84+
$reader.ReadToEnd()
85+
```
7586

76-
1. Invoke your function with the AWS CLI `invoke` command\.
87+
1. Alternatively, invoke your function with the AWS CLI `invoke` command\.
7788

7889
```
79-
> aws lambda invoke --function-name MyFirstPSScript out
80-
```
90+
> aws lambda invoke --function-name MyFirstPSScript response.json
91+
```
92+
93+
The response data payload returned from the function is stored as `response.json`\. View the file using an appropriate tool for the operating system you are running the AWS CLI on\.
94+
95+
**Linux or macOS**
96+
97+
```
98+
$ cat response.json
99+
```
100+
101+
**Windows command prompt**
102+
103+
```
104+
C:\> type response.json
105+
```

0 commit comments

Comments
 (0)