Skip to content

Instantly share code, notes, and snippets.

@alexcasalboni
Last active October 8, 2019 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexcasalboni/23efcacf7b5164f3ef01edbc8770266f to your computer and use it in GitHub Desktop.
Save alexcasalboni/23efcacf7b5164f3ef01edbc8770266f to your computer and use it in GitHub Desktop.
AWS CodePilpeline - Lambda stage (YAML)
AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
myPipelineFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Policies:
- AWSLambdaExecute # Managed Policy
- Version: '2012-10-17' # Policy Document
Statement:
- Effect: Allow
Action:
- codepipeline:PutJobSuccessResult
- codepipeline:PutJobFailureResult
Resource: '*'
# ...
# all the other properties here
# ...
myPipelineLambdaPermission:
Type: AWS::Lambda::Permission
Properties:
FunctionName: !Ref myPipelineFunction
Action: lambda:InvokeFunction
Principal:
Service: 'codepipeline.amazonaws.com'
SourceAccount: !Ref 'AWS::AccountId'
SourceArn: !GetAtt myPipeline.Arn
myPipeline:
Type: AWS::CodePipeline::Pipeline
Properties:
ArtifactStore:
Type: S3
Location: my-pipeline-bucket
RoleArn: !Ref MyIAMRoleForCodePipeline
Stages:
- ... OTHER STAGES HERE (deploy the website) ...
- Name: myCustomStage
Actions:
- ActionTypeId:
Category: Invoke
Owner: AWS
Provider: Lambda
Version: '1.0'
Configuration:
FunctionName: !Ref myPipelineFunction
UserParameters: 'http://mywebsite.com'
Name: Lambda
outputArtifacts: []
inputArtifacts: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment