Skip to content

Commit

Permalink
Test event added; scripts README => running notes
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanthmanda committed Oct 24, 2020
1 parent fcecb10 commit 7a98452
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Following are the components of this [Rube Goldberg application](https://en.wiki
## Notes

- [Lambda](notes/lambda-notes.md)
- [Deployment](scripts/README.md)
- [Running Notes](notes/running-notes.md)

## Resources

Expand Down
2 changes: 2 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
- [x] Parameterize S3 bucket name
- [x] Make S3 bucket private
- [x] Move `aws-sdk` package to layer
- [ ] Automate creation of S3 bucket for SAM CLI
- [x] Add Lambda functions test events for [CLI](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/lambda/invoke.html) (not [console](https://github.com/aws/serverless-application-model/issues/475))
30 changes: 30 additions & 0 deletions notes/running-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Running Notes

## SAM CLI Limitation

Due to a [limitation](https://github.com/aws/aws-sam-cli/issues/1701), `sam deploy` requires either:
- `--s3-bucket` command line argument OR
- It needs to be run for the first time with `--guided` or `-g` flags. SAM creates a S3 bucket during guided run.

Once you have the S3 bucket to upload your code to, you may -
- Add it to samconfig TOML files as `s3_bucket = "<aws-sam-cli-managed-default-samclisourcebucket-...>"` OR
- Add a `--s3-bucket <aws-sam-cli-managed-default-samclisourcebucket-...>` argument to `sam deploy` commands in `1-deploy.sh` script.

## Invoking Lambda functions from CLI

```
aws lambda invoke --function-name getAwsDocsRepo \
getAwsDocsRepo-response.json
```

```
aws lambda invoke --function-name unzipRepoArchive \
unzipRepoArchive-response.json \
--cli-binary-format raw-in-base64-out \
--payload "$(< test-events/unzip-repo-archive-test-event.json)"
```

### Note

- Above commands invoke Lambda synchronously. So any async destination will not get invocation record.
- Add `--invocation-type Event` clause to invoke Lambda asynchronously.
8 changes: 0 additions & 8 deletions scripts/README.md

This file was deleted.

14 changes: 14 additions & 0 deletions test-events/unzip-repo-archive-test-event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Records": [
{
"s3": {
"bucket": {
"name": "0fef02b1-1c46-435a-a0e7-945a233f19a6"
},
"object": {
"key": "aws-cloudformation-user-guide.zip"
}
}
}
]
}

0 comments on commit 7a98452

Please sign in to comment.