Skip to content
This project demonstrate usage of CloudFormation template for creating a CloudFormation stack comprising of SNS topic, Subscription, Dynamodb table, Lambda persisting event in DynamoDB table and IAM role
JavaScript Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE Initial import Apr 15, 2018
README.md Updated README and cleaned up Cloudformation Template Apr 15, 2018
cloudformation-template.yaml Updated README and cleaned up Cloudformation Template Apr 15, 2018
deploy.sh
index.js Moved DynamoDB client creation at top level May 21, 2018
package-lock.json
package.json

README.md

Example CloudFormation Template for creating a CloudFormation stack comprising of SNS topic, Subscription, Dynamodb table, Lambda persisting event in dynamodb table and IAM role

This template creates a CloudFormation stack comprising of -

  • SNS topic
  • Simple Node.js Lambda
  • Dynamodb Table
  • Simple Node.js Lambda persisting event into Dynamodb table
  • Lambda SNS topic subscription
  • IAM Roles and Policies

This template is intended to jump start Lambda development by putting otherwise extensive and fragmented information together. Additional information is available at Shift from Containers to Serverless Computing using AWS Lambda - Part 2

How to run?

Prerequisite : AWS account and AWS CLI

Create a package by running following AWS CLI command

aws cloudformation package --template-file cloudformation-template.yaml --s3-bucket <your-bucket-name> 
    --output-template-file packaged-template.yaml

Create Stack using following command

aws cloudformation deploy --template-file packaged-template.yaml --stack-name <your-stack-name> --capabilities CAPABILITY_IAM

Test

List stack resources using following command

aws cloudformation list-stack-resources --stack-name <your-stack-name>

Please copy SNS topic(AWS::SNS::Topic) ARN (PhysicalResourceId) from list of resources.

Now you can publish a message to SNS topic using following command. Lambda should persist the event in Dynamoddb table.

aws sns publish --topic-arn <your-sns-topic-arn> --message '{"name": "Foo", "iban": "NL38FRBK0292964727"}'
You can’t perform that action at this time.