Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

56 lines (53 sloc) 1.59 KB
AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: An example SAM template for Lambda Safe Deployments.
Resources:
returnS3Buckets:
Type: AWS::Serverless::Function
Properties:
Handler: returnS3Buckets.handler
Runtime: nodejs6.10
AutoPublishAlias: live
Policies:
- Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action:
- "s3:ListAllMyBuckets"
Resource: '*'
DeploymentPreference:
Type: Linear10PercentEvery1Minute
Hooks:
PreTraffic: !Ref preTrafficHook
Events:
Api:
Type: Api
Properties:
Path: /test
Method: get
preTrafficHook:
Type: AWS::Serverless::Function
Properties:
Handler: preTrafficHook.handler
Policies:
- Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action:
- "codedeploy:PutLifecycleEventHookExecutionStatus"
Resource:
!Sub 'arn:aws:codedeploy:${AWS::Region}:${AWS::AccountId}:deploymentgroup:${ServerlessDeploymentApplication}/*'
- Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action:
- "lambda:InvokeFunction"
Resource: !Ref returnS3Buckets.Version
Runtime: nodejs6.10
FunctionName: 'CodeDeployHook_preTrafficHook'
DeploymentPreference:
Enabled: false
Timeout: 5
Environment:
Variables:
NewVersion: !Ref returnS3Buckets.Version
You can’t perform that action at this time.