Guest User

Untitled

a guest
Jul 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. CodeBuild:
  2. Type: 'AWS::CodeBuild::Project'
  3. Properties:
  4. Name: !Sub ${AWS::StackName}-CodeBuild
  5. ServiceRole: !GetAtt CodeBuildRole.Arn
  6. Artifacts:
  7. Type: CODEPIPELINE
  8. Name: MyProject
  9. Source:
  10. Type: CODEPIPELINE
  11. Environment:
  12. ComputeType: BUILD_GENERAL1_SMALL
  13. Type: LINUX_CONTAINER
  14. Image: "aws/codebuild/nodejs:8.11.0"
  15. Source:
  16. Type: CODEPIPELINE
  17. BuildSpec: !Sub |
  18. version: 0.1
  19. phases:
  20. pre_build:
  21. commands:
  22. - echo Installing source NPM dependencies...
  23. - npm install
  24. build:
  25. commands:
  26. - echo Build started on `date`
  27. - npm run build
  28. post_build:
  29. commands:
  30. - aws s3 cp --recursive --acl public-read ./build s3://${DeployBucket}/
  31. artifacts:
  32. files:
  33. - '**/*'
  34. base-directory: build
  35. CodeBuildRole:
  36. Type: AWS::IAM::Role
  37. Properties:
  38. AssumeRolePolicyDocument:
  39. Version: "2012-10-17"
  40. Statement:
  41. -
  42. Effect: Allow
  43. Principal:
  44. Service:
  45. - "codebuild.amazonaws.com"
  46. Action:
  47. - "sts:AssumeRole"
  48. Path: /service-role/
  49. Policies:
  50. - PolicyName: root
  51. PolicyDocument:
  52. Version: "2012-10-17"
  53. Statement:
  54. -
  55. Effect: Allow
  56. Action:
  57. - "s3:GetObject"
  58. - "s3:GetObjectVersion"
  59. - "s3:GetBucketVersioning"
  60. - "s3:PutObject"
  61. Resource:
  62. - !GetAtt PipelineBucket.Arn
  63. - !Join ['', [!GetAtt PipelineBucket.Arn, "/*"]]
  64. -
  65. Effect: Allow
  66. Action:
  67. - "s3:GetObject"
  68. - "s3:GetObjectVersion"
  69. - "s3:GetBucketVersioning"
  70. - "s3:PutObject"
  71. - "s3:PutObjectAcl"
  72. Resource:
  73. - !GetAtt DeployBucket.Arn
  74. - !Join ['', [!GetAtt DeployBucket.Arn, "/*"]]
  75. -
  76. Effect: Allow
  77. Action:
  78. - "logs:CreateLogGroup"
  79. - "logs:CreateLogStream"
  80. - "logs:PutLogEvents"
  81. Resource:
  82. - "*"
Add Comment
Please, Sign In to add comment