Skip to content

Instantly share code, notes, and snippets.

@adhorn
Created May 3, 2018 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adhorn/d656dea8ddd140ee222f1b8a889157b3 to your computer and use it in GitHub Desktop.
Save adhorn/d656dea8ddd140ee222f1b8a889157b3 to your computer and use it in GitHub Desktop.
Serverless framework to support deploy Lambda Functions in VPC
STATUS: 200
lambdaExecSecurityGroups: ["sg-xxxxxxx"]
subnets: ["subnet-xxxxxxx"]
STATUS: 200
lambdaExecSecurityGroups: ["sg-xxxxxxx"]
subnets: ["subnet-xxxxxx"]
service: blog
provider:
name: aws
vpc:
securityGroupIds:
${file(env_${opt:region}.yml):lambdaExecSecurityGroups}
subnetIds:
${file(env_${opt:region}.yml):subnets}
runtime: python2.7
memorySize: 512
environment:
STATUS: ${file(env.yml):STATUS}
iamRoleStatements:
- Effect: "Allow"
Action:
- "dynamodb:*"
Resource:
- "arn:aws:dynamodb:${opt:region}:xxxxxxxxxxxxx:table/MyGlobalTable"
- Effect: "Allow"
Action:
- "logs:CreateLogGroup"
- "logs:CreateLogStream"
- "logs:PutLogEvents"
- "xray:PutTraceSegments"
- "xray:PutTelemetryRecords"
Resource:
- "*"
package:
include:
- vendored/**
exclude:
- .git/**
functions:
get_item:
handler: get.get_item
events:
- http:
path: get/{item_id}
method: GET
cors: true
create_item:
handler: post.create_item
events:
- http:
path: create
method: POST
cors: true
get_health:
handler: health.lambda_handler
events:
- http:
path: health
method: GET
cors: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment