AWS Lambda Guide — Serverless.yml Reference
Published in
2 min readJul 6, 2018
Here is a list of all available properties in serverless.yml
when the provider is set to aws
.
service: name: myService awsKmsKeyArn: arn:aws:kms:us-east-1:XXXXXX:key/some-hash frameworkVersion: ">=1.0.0 <2.0.0" provider: name: aws runtime: nodejs6.10 stage: dev region: us-east-1 stackName: custom-stack-name apiName: custom-api-name profile: production memorySize: 512 timeout: 10 logRetentionInDays: 14 deploymentBucket: name: com.serverless.${self:provider.region}.deploys serverSideEncryption: AES256 role: arn:aws:iam::XXXXXX:role/role cfnRole: arn:aws:iam::XXXXXX:role/role versionFunctions: false environment: serviceEnvVar: 123456789 endpointType: regional apiKeys: - myFirstKey - ${opt:stage}-myFirstKey - ${env:MY_API_KEY} apiGateway: restApiId: xxxxxxxxxx restApiRootResourceId: xxxxxxxxxx restApiResources: '/users': xxxxxxxxxx '/users/create': xxxxxxxxxx usagePlan: quota: limit: 5000 offset: 2 period: MONTH throttle: burstLimit: 200 rateLimit: 100 stackTags: key: value iamManagedPolicies: - arn:aws:iam:*****:policy/some-managed-policy iamRoleStatements: - Effect: 'Allow' Action: - 's3:ListBucket' Resource: Fn::Join: - '' - - 'arn:aws:s3:::' - Ref: ServerlessDeploymentBucket stackPolicy: - Effect: Allow Principal: "*" Action: "Update:*" Resource: "*" - Effect: Deny Principal: "*" Resource: "*" Action: - Update:Replace - Update:Delete Condition: StringEquals: ResourceType: - AWS::EC2::Instance vpc: securityGroupIds: - securityGroupId1 - securityGroupId2 subnetIds: - subnetId1 - subnetId2 notificationArns: - 'arn:aws:sns:us-east-1:XXXXXX:mytopic' resourcePolicy: - Effect: Allow Principal: "*" Action: execute-api:Invoke Resource: - execute-api:/*/*/* Condition: IpAddress: aws:SourceIp: - "123.123.123.123" tags: foo: bar baz: qux package: include: - src/** - handler.js exclude: - .git/** - .travis.yml excludeDevDependencies: false artifact: path/to/my-artifact.zip individually: true functions: usersCreate: handler: users.create name: ${self:provider.stage}-lambdaName description: My function memorySize: 512 runtime: nodejs6.10 timeout: 10 role: arn:aws:iam::XXXXXX:role/role onError: arn:aws:sns:us-east-1:XXXXXX:sns-topic awsKmsKeyArn: arn:aws:kms:us-east-1:XXXXXX:key/some-hash environment: functionEnvVar: 12345678 tags: foo: bar vpc: securityGroupIds: - securityGroupId1 - securityGroupId2 subnetIds: - subnetId1 - subnetId2 package: include: - src/** - handler.js exclude: - .git/** - .travis.yml artifact: path/to/my-artifact.zip individually: true events: - http: path: users/create method: get cors: true private: true authorizer: name: authorizerFunc arn: xxx:xxx:Lambda-Name resultTtlInSeconds: 0 identitySource: method.request.header.Authorization identityValidationExpression: someRegex - s3: bucket: photos event: s3:ObjectCreated:* rules: - prefix: uploads/ - suffix: .jpg - schedule: name: my scheduled event description: a description of my scheduled event's purpose rate: rate(10 minutes) enabled: false input: key1: value1 key2: value2 stageParams: stage: dev inputPath: '$.stageVariables' - sns: topicName: aggregate displayName: Data aggregation pipeline - stream: arn: arn:aws:kinesis:region:XXXXXX:stream/foo batchSize: 100 startingPosition: LATEST enabled: false - alexaSkill: appId: amzn1.ask.skill.xx-xx-xx-xx enabled: true - alexaSmartHome: appId: amzn1.ask.skill.xx-xx-xx-xx enabled: true - iot: name: myIoTEvent description: An IoT event enabled: true sql: "SELECT * FROM 'some_topic'" sqlVersion: beta - cloudwatchEvent: event: source: - "aws.ec2" detail-type: - "EC2 Instance State-change Notification" detail: state: - pending input: key1: value1 key2: value2 stageParams: stage: dev inputPath: '$.stageVariables' - cloudwatchLog: logGroup: '/aws/lambda/hello' filter: '{$.userIdentity.type = Root}' - cognitoUserPool: pool: MyUserPool trigger: PreSignUp resources: Resources: usersTable: Type: AWS::DynamoDB::Table Properties: TableName: usersTable AttributeDefinitions: - AttributeName: email AttributeType: S KeySchema: - AttributeName: email KeyType: HASH ProvisionedThroughput: ReadCapacityUnits: 1 WriteCapacityUnits: 1 Outputs: UsersTableArn: Description: The ARN for the User's Table Value: "Fn::GetAtt": [ usersTable, Arn ] Export: Name: ${self:service}:${opt:stage}:UsersTableArn
Originally published at serverless.com.