Skip to content

nrdio/lambda-cloudformation-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example CloudFormation Template for creating a CloudFormation stack comprising of SNS topic, Subscription and Lambda

This template creates a CloudFormation stack comprising of -

  • SNS topic
  • Simple Node.js Lambda
  • Lambd 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

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 log the event in CloudWatch logs.

aws sns publish --topic-arn your-sns-topic-arn --message "Hello World"

About

CloudFormation template example for creating a CloudFormation stack comprising of SNS topic, Lambda and Subscription

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages