Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CodeBuild:
- Type: 'AWS::CodeBuild::Project'
- Properties:
- Name: !Sub ${AWS::StackName}-CodeBuild
- ServiceRole: !GetAtt CodeBuildRole.Arn
- Artifacts:
- Type: CODEPIPELINE
- Name: MyProject
- Source:
- Type: CODEPIPELINE
- Environment:
- ComputeType: BUILD_GENERAL1_SMALL
- Type: LINUX_CONTAINER
- Image: "aws/codebuild/nodejs:8.11.0"
- Source:
- Type: CODEPIPELINE
- BuildSpec: !Sub |
- version: 0.1
- phases:
- pre_build:
- commands:
- - echo Installing source NPM dependencies...
- - npm install
- build:
- commands:
- - echo Build started on `date`
- - npm run build
- post_build:
- commands:
- - aws s3 cp --recursive --acl public-read ./build s3://${DeployBucket}/
- artifacts:
- files:
- - '**/*'
- base-directory: build
- CodeBuildRole:
- Type: AWS::IAM::Role
- Properties:
- AssumeRolePolicyDocument:
- Version: "2012-10-17"
- Statement:
- -
- Effect: Allow
- Principal:
- Service:
- - "codebuild.amazonaws.com"
- Action:
- - "sts:AssumeRole"
- Path: /service-role/
- 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:
- - "s3:GetObject"
- - "s3:GetObjectVersion"
- - "s3:GetBucketVersioning"
- - "s3:PutObject"
- - "s3:PutObjectAcl"
- Resource:
- - !GetAtt DeployBucket.Arn
- - !Join ['', [!GetAtt DeployBucket.Arn, "/*"]]
- -
- Effect: Allow
- Action:
- - "logs:CreateLogGroup"
- - "logs:CreateLogStream"
- - "logs:PutLogEvents"
- Resource:
- - "*"
Add Comment
Please, Sign In to add comment