-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgreengrass_bootstrap.template.yaml
139 lines (138 loc) · 4.57 KB
/
greengrass_bootstrap.template.yaml
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
AWSTemplateFormatVersion: '2010-09-09'
Metadata:
License: Apache-2.0
Description: 'Sample cloudformation template that creates default Greengrass provisioning resources.'
Resources:
GreengrassProvisioningUser:
Type: AWS::IAM::User
S3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
VersioningConfiguration:
Status: Enabled
GreengrassProvisioningUserGroup:
Type: AWS::IAM::Group
Users:
Type: AWS::IAM::UserToGroupAddition
Properties:
GroupName: !Ref 'GreengrassProvisioningUserGroup'
Users: [!Ref 'GreengrassProvisioningUser']
GreengrassTokenExchangeRole:
Type: AWS::IAM::Role
Properties:
RoleName: "GreengrassV2TokenExchangeRole"
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service:
- credentials.iot.amazonaws.com
Action:
- 'sts:AssumeRole'
RobotPolicy:
Type: AWS::IAM::Policy
Properties:
PolicyName: RobotPolicy
PolicyDocument:
Statement:
- Effect: Allow
Action: [ "s3:ListBucket" ]
Resource: !Join ["",[ "arn:aws:s3:::", !Ref S3Bucket ] ]
- Effect: Allow
Action: [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject"
]
Resource: !Join ["",["arn:aws:s3:::", !Ref S3Bucket,"/*"] ]
- Effect: Allow
Action: [
"ecr:GetAuthorizationToken",
"ecr:BatchGetImage",
"ecr:GetDownloadUrlForLayer"
]
Resource: '*'
- Effect: Allow
Action: [ "greengrass:" ]
Resource: '*'
- Effect: Allow
Action: [ "iot:" ]
Resource: '*'
Roles: [ !Ref 'GreengrassTokenExchangeRole' ]
GreengrassTokenPolicy:
Type: AWS::IAM::Policy
Properties:
PolicyName: GreengrassTokenExchangePolicy
PolicyDocument:
Statement:
- Effect: Allow
Action: [
"iot:DescribeCertificate",
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:DescribeLogStreams",
"iot:Connect",
"iot:Publish",
"iot:Subscribe",
"iot:Receive",
"s3:GetBucketLocation"
]
Resource: '*'
Roles: [ !Ref 'GreengrassTokenExchangeRole' ]
GreengrassProvisioningUserPolicies:
Type: AWS::IAM::Policy
Properties:
PolicyName: GreengrassProvisioningUsers
PolicyDocument:
Statement:
- Effect: Allow
Action: [
"iot:AddThingToThingGroup",
"iot:AttachPolicy",
"iot:AttachThingPrincipal",
"iot:CreateKeysAndCertificate",
"iot:CreatePolicy",
"iot:CreateRoleAlias",
"iot:CreateThing",
"iot:CreateThingGroup",
"iot:DescribeEndpoint",
"iot:DescribeRoleAlias",
"iot:DescribeThingGroup",
"iot:GetPolicy",
"iam:GetRole",
"iam:CreateRole",
"iam:PassRole",
"iam:CreatePolicy",
"iam:AttachRolePolicy",
"iam:GetPolicy",
"sts:GetCallerIdentity"
]
Resource: '*'
- Effect: Allow
Action: [
"greengrass:CreateDeployment",
"iot:CancelJob",
"iot:CreateJob",
"iot:DeleteThingShadow",
"iot:DescribeJob",
"iot:DescribeThing",
"iot:DescribeThingGroup",
"iot:GetThingShadow",
"iot:UpdateJob",
"iot:UpdateThingShadow"
]
Resource: '*'
Groups: [!Ref 'GreengrassProvisioningUserGroup']
Outputs:
UserName:
Value: !Ref GreengrassProvisioningUser
Description: User name for the provisioning user.
S3BucketName:
Value: !Ref S3Bucket
Description: S3 bucket to upload assets to.