Skip to content

Commit f36eb59

Browse files
committed
docs: Add sample command with optional parameters to README
1 parent 5eecb74 commit f36eb59

3 files changed

Lines changed: 24 additions & 9 deletions

File tree

lambda-s3-download/README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The function is configured with a 15-minute timeout, 1 GB memory, and 10 GB ephe
5454
5555
## Testing
5656
57-
Invoke the Lambda function with a test event:
57+
Retrieve the Lambda function's name from the SAM deployment output and invoke it with a test event:
5858
5959
```bash
6060
aws lambda invoke \
@@ -75,6 +75,22 @@ Optional event parameters:
7575
| `target_bucket_region` | S3 bucket region | Lambda's region |
7676
| `chunk_size_mb` | Size of each download chunk in MB (clamped between 5 and 5120) | 512 |
7777

78+
Example with all optional parameters:
79+
80+
```bash
81+
aws lambda invoke \
82+
--function-name FUNCTION_NAME \
83+
--cli-binary-format raw-in-base64-out \
84+
--payload '{
85+
"download_url": "https://example.com/file.zip",
86+
"download_filename": "file.zip",
87+
"target_bucket": "my-other-bucket",
88+
"target_bucket_region": "eu-central-1",
89+
"chunk_size_mb": 256
90+
}' \
91+
response.json
92+
```
93+
7894
## Known Limitations
7995

8096
- The Lambda function has a 15-minute maximum timeout. If the download and upload combined take longer than that, the function will be killed mid-stream and the multipart upload will be left incomplete. Consider setting an [S3 lifecycle rule](https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpu-abort-incomplete-mpu-lifecycle-config.html) on the target bucket to auto-clean incomplete multipart uploads.
@@ -85,12 +101,8 @@ Optional event parameters:
85101
## Cleanup
86102

87103
1. Delete the stack
88-
```bash
89-
aws cloudformation delete-stack --stack-name STACK_NAME
90104
```
91-
1. Confirm the stack has been deleted
92-
```bash
93-
aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"
105+
sam delete
94106
```
95107
----
96108
Copyright 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved.

lambda-s3-download/example-pattern.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@
4545
},
4646
"cleanup": {
4747
"text": [
48-
"Delete the stack: <code>aws cloudformation delete-stack --stack-name STACK_NAME</code>."
48+
"Delete the stack: <code>sam delete</code>."
4949
]
5050
},
5151
"authors": [
5252
{
5353
"name": "Robert Meyer",
54-
"image": "https://serverlessland.com/assets/images/resources/contributors/ext-robert-meyer.jpg",
54+
"image": "",
5555
"bio": "Robert is a Partner Solutions Architect with AWS in EMEA.",
5656
"linkedin": "https://www.linkedin.com/in/robert-meyer-phd-6a114a58/",
5757
"twitter": "@robl_on_tour"

lambda-s3-download/template.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Resources:
1212
Type: AWS::Serverless::Function
1313
Properties:
1414
Handler: app.lambda_handler
15-
Runtime: python3.12
15+
Runtime: python3.14
1616
CodeUri: src/
1717
Timeout: 900
1818
MemorySize: 1024
@@ -26,6 +26,9 @@ Resources:
2626
BucketName: !Ref TargetBucketName
2727

2828
Outputs:
29+
DownloadFunctionName:
30+
Description: Serverless Downloader Lambda Function Name
31+
Value: !GetAtt DownloadFunction.Name
2932
DownloadFunctionArn:
3033
Description: Serverless Downloader Lambda function ARN
3134
Value: !GetAtt DownloadFunction.Arn

0 commit comments

Comments
 (0)