Skip to content

Instantly share code, notes, and snippets.

lambda-deploy.js

Description

A standalone executable that helps in deploying AWS lambda functions.

Synopsis

lambda-deploy.js --function-name FUNCTION_NAME --region REGION --action (create|update|delete) --path /path/to/your/project [ARGS]

CloudFormation snippet to create a VPC to be used for lambda functions. Qualities of the VPC:

  • 4 subnets: 2 public, 2 private (lambda functions should be attached to the private ones).
  • 2 Elastic IPs that can be used to identify traffic coming from lambda functions (e.g. for firewall holes).
  • Security group that can be used for lambda functions.

Notes:

  • uses regions us-east-1a, us-east-1b
  • uses ip block of 10.15.0.0/16 for VPC
cat <<EOM > /tmp/assume-role-policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"redshift.amazonaws.com"
]