This repository has been archived by the owner on Aug 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaws-ci-roles.yml
163 lines (162 loc) · 5.65 KB
/
aws-ci-roles.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
AWSTemplateFormatVersion: '2010-09-09'
Description: Roles needed for CI/CD pipeline for ReCiter and also an S3 bucket to store pipeline artifacts
Resources:
CodeBuildRole:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Statement:
-
Action:
- 'sts:AssumeRole'
Effect: Allow
Principal:
Service:
- codebuild.amazonaws.com
Version: '2012-10-17'
Path: /
Policies:
-
PolicyDocument:
Statement:
-
Action:
- 'logs:Put*'
- 'logs:Create*'
- 's3:Put*'
- 's3:GetObject'
- 's3:GetObjectVersion'
- 's3:GetBucketVersioning'
Effect: Allow
Resource: '*'
Version: '2012-10-17'
PolicyName: codebuild-ci-reciter-CodeBuildPolicy
RoleName: codebuild-ci-reciter-CodeBuildRole
#Service Role to be used for the code pipeline
CodePipelineRole:
Type: "AWS::IAM::Role"
Properties:
RoleName:
Fn::Sub: CodePipelineRole-${AWS::StackName}
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Principal:
Service:
- "codepipeline.amazonaws.com"
Action:
- "sts:AssumeRole"
Path: /
Policies:
-
PolicyName: "CodePipelineAccessPolicy"
PolicyDocument:
Version: "2012-10-17"
Statement:
-
Action:
- 's3:GetObject'
- 's3:GetObjectVersion'
- 's3:GetBucketVersioning'
Resource: '*'
Effect: Allow
-
Action:
- 's3:PutObject'
Resource:
- 'arn:aws:s3:::codepipeline*'
- 'arn:aws:s3:::elasticbeanstalk*'
Effect: Allow
-
Action:
- 'codedeploy:CreateDeployment'
- 'codedeploy:GetApplicationRevision'
- 'codedeploy:GetDeployment'
- 'codedeploy:GetDeploymentConfig'
- 'codedeploy:RegisterApplicationRevision'
Resource: '*'
Effect: Allow
-
Action:
- 'logs:*'
- 'elasticbeanstalk:*'
- 'ec2:*'
- 'elasticloadbalancing:*'
- 'autoscaling:*'
- 'cloudwatch:*'
- 's3:*'
- 'sns:*'
- 'cloudformation:*'
- 'rds:*'
- 'sqs:*'
- 'ecs:*'
Resource: '*'
Effect: Allow
-
Action:
- 'opsworks:CreateDeployment'
- 'opsworks:DescribeApps'
- 'opsworks:DescribeCommands'
- 'opsworks:DescribeDeployments'
- 'opsworks:DescribeInstances'
- 'opsworks:DescribeStacks'
- 'opsworks:UpdateApp'
- 'opsworks:UpdateStack'
Resource: '*'
Effect: Allow
-
Action:
- 's3:ListBucket'
- 's3:GetBucketPolicy'
- 's3:GetObjectAcl'
- 's3:PutObjectAcl'
- 's3:DeleteObject'
Resource: 'arn:aws:s3:::elasticbeanstalk*'
Effect: Allow
-
Action:
- "codebuild:StartBuild"
- "codebuild:BatchGetBuilds"
Resource: '*'
Effect: "Allow"
CodePipelineS3Bucket:
Type: AWS::S3::Bucket
Properties:
AccessControl: Private
BucketName:
!Join
- '-'
-
- 'codepipeline'
- !Ref 'AWS::Region'
- !Ref 'AWS::AccountId'
Tags:
- Key: 'venue'
Value: 'reciter-workshop'
Outputs:
CodeBuildName:
Description: CodeBuild service role name
Value:
Ref: CodeBuildRole
Export:
Name: codebuild-service-role
CodePipelineRoleName:
Description: CodePipeline service role name
Value:
Ref: CodePipelineRole
Export:
Name: codepipeline-service-role
CodePipelineRoleNameArn:
Description: CodePipeline service role name arn
Value:
!GetAtt CodePipelineRole.Arn
Export:
Name: codepipeline-service-role-arn
CodePipelineS3BucketName:
Description: CodePipeline bucket name
Value:
!Ref CodePipelineS3Bucket
Export:
Name: codepipeline-s3-bucket-name