Skip to content

Instantly share code, notes, and snippets.

@qswitcher
Created July 21, 2018 05:29
Show Gist options
  • Save qswitcher/76b69d430248603f2bfc2ce3cda3ccf8 to your computer and use it in GitHub Desktop.
Save qswitcher/76b69d430248603f2bfc2ce3cda3ccf8 to your computer and use it in GitHub Desktop.
AWSTemplateFormatVersion: 2010-09-09
Parameters:
ProjectSource:
Type: String
Default: "https://github.com/qswitcher/imgterest"
Description: "Source control URL (e.g. Github)"
GithubOwner:
Type: String
Default: qswitcher
GithubRepo:
Type: String
Default: my-test-app
GithubOAuthToken:
Type: String
Description: "Github personal access token"
Resources:
# ... S3 bucket config ...
# ... CloudFront config ...
# ... CodeBuild config ...
CodePipeline:
Type: 'AWS::CodePipeline::Pipeline'
Properties:
RoleArn: !GetAtt CodePipeLineRole.Arn
ArtifactStore:
Location: !Ref PipelineBucket
Type: S3
Stages:
-
Name: Source
Actions:
-
Name: SourceAction
ActionTypeId:
Category: Source
Owner: ThirdParty
Provider: GitHub
Version: 1
OutputArtifacts:
-
Name: MyApp
Configuration:
Owner: !Ref GithubOwner
Repo: !Ref GithubRepo
Branch: master
OAuthToken: !Ref GithubOAuthToken
-
Name: Build
Actions:
-
Name: BuildAction
ActionTypeId:
Category: Build
Owner: AWS
Version: 1
Provider: CodeBuild
InputArtifacts:
-
Name: MyApp
OutputArtifacts:
-
Name: MyAppBuild
Configuration:
ProjectName: !Ref CodeBuild
CodePipeLineRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: Allow
Principal:
Service:
- "codepipeline.amazonaws.com"
Action:
- "sts:AssumeRole"
Policies:
- PolicyName: root
PolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: Allow
Action:
- "s3:GetObject"
- "s3:GetObjectVersion"
- "s3:GetBucketVersioning"
- "s3:PutObject"
Resource:
- !GetAtt PipelineBucket.Arn
- !Join ['', [!GetAtt PipelineBucket.Arn, "/*"]]
-
Effect: Allow
Action:
- "codebuild:BatchGetBuilds"
- "codebuild:StartBuild"
Resource: "*"
PipelineBucket:
Type: 'AWS::S3::Bucket'
Properties: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment