Skip to content

Commit dce8bed

Browse files
authored
Update Lambda Deployment Package in PowerShell
To provide function invocation example from AWS Tools for Powershell, and add response payload to the examples.
1 parent d955593 commit dce8bed

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

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)