Skip to content

Commit a9c963f

Browse files
Autoupdate-1
1 parent 3b175ce commit a9c963f

File tree

5 files changed

+413
-0
lines changed

5 files changed

+413
-0
lines changed

.github/actions/build_aws_eif/action.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ runs:
9797
cp ${{ steps.buildFolder.outputs.BUILD_FOLDER }}/identity_scope.txt ${ARTIFACTS_OUTPUT_DIR}/
9898
cp ${{ steps.buildFolder.outputs.BUILD_FOLDER }}/version_number.txt ${ARTIFACTS_OUTPUT_DIR}/
9999
cp ./scripts/aws/ec2.py ${ARTIFACTS_OUTPUT_DIR}/
100+
cp ./scripts/aws/autoupdate.py ${ARTIFACTS_OUTPUT_DIR}/
100101
cp ./scripts/confidential_compute.py ${ARTIFACTS_OUTPUT_DIR}/
101102
cp ./scripts/aws/requirements.txt ${ARTIFACTS_OUTPUT_DIR}/
102103
cp ./scripts/aws/proxies.host.yaml ${ARTIFACTS_OUTPUT_DIR}/
@@ -112,6 +113,7 @@ runs:
112113
cp ./scripts/aws/logrotate/operator-logrotate.conf ${ARTIFACTS_OUTPUT_DIR}/
113114
cp ./scripts/aws/logrotate/logrotate ${ARTIFACTS_OUTPUT_DIR}/
114115
cp ./scripts/aws/logrotate/logrotateDaily ${ARTIFACTS_OUTPUT_DIR}/
116+
cp ./scripts/aws/logrotate/autoupdate ${ARTIFACTS_OUTPUT_DIR}/
115117
cp -r ./scripts/aws/config-server ${ARTIFACTS_OUTPUT_DIR}/
116118
117119
docker cp amazonlinux:/sockd ${ARTIFACTS_OUTPUT_DIR}/

scripts/aws/UID_CloudFormation.template.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ Resources:
136136
- 'kms:GenerateDataKey*'
137137
- 'kms:Describe*'
138138
Resource: '*'
139+
Tags:
140+
- Key: Project
141+
Value: UID2
139142
SSMKEYAlias:
140143
Type: AWS::KMS::Alias
141144
Properties:
@@ -164,6 +167,9 @@ Resources:
164167
- Ref: DeployToEnvironment
165168
- '"'
166169
- '}'
170+
Tags:
171+
- Key: Project
172+
Value: UID2
167173
WorkerRole:
168174
Type: 'AWS::IAM::Role'
169175
Properties:
@@ -190,14 +196,46 @@ Resources:
190196
- Effect: Allow
191197
Action: 'secretsmanager:GetSecretValue'
192198
Resource: !Sub 'arn:aws:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:uid2-config-stack-${AWS::StackName}*'
199+
- Sid: EC2LaunchTemplateWrite
200+
Effect: Allow
201+
Action:
202+
- 'ec2:CreateLaunchTemplateVersion'
203+
Resource:
204+
- 'arn:aws:ec2:*:*:launch-template/*'
205+
Condition:
206+
StringEquals:
207+
'aws:ResourceTag/Project': 'UID2'
208+
- Sid: AutoScalingReadPermissions
209+
Effect: Allow
210+
Action:
211+
- 'autoscaling:DescribeAutoScalingInstances'
212+
- 'autoscaling:DescribeAutoScalingGroups'
213+
- 'autoscaling:DescribeInstanceRefreshes'
214+
Resource: '*'
215+
- Sid: AutoScalingWritePermissions
216+
Effect: Allow
217+
Action:
218+
- 'autoscaling:UpdateAutoScalingGroup'
219+
- 'autoscaling:StartInstanceRefresh'
220+
Resource:
221+
- 'arn:aws:autoscaling:*:*:autoScalingGroup:*:autoScalingGroupName/*'
222+
Condition:
223+
StringEquals:
224+
'aws:ResourceTag/Project': 'UID2'
193225
ManagedPolicyArns:
194226
- 'arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy'
227+
Tags:
228+
- Key: Project
229+
Value: UID2
195230
WorkerInstanceProfile:
196231
Type: 'AWS::IAM::InstanceProfile'
197232
Properties:
198233
Path: /
199234
Roles:
200235
- !Ref WorkerRole
236+
Tags:
237+
- Key: Project
238+
Value: UID2
201239
SecurityGroup:
202240
Type: 'AWS::EC2::SecurityGroup'
203241
Properties:
@@ -230,6 +268,9 @@ Resources:
230268
CidrIp: 0.0.0.0/0
231269
Description: "Allow Outbound DNS"
232270
VpcId: !Ref VpcId
271+
Tags:
272+
- Key: Project
273+
Value: UID2
233274
LaunchTemplate:
234275
Type: AWS::EC2::LaunchTemplate
235276
Properties:
@@ -261,6 +302,18 @@ Resources:
261302
HttpTokens: required # Enforces IMDSv2
262303
HttpPutResponseHopLimit: 1
263304
InstanceMetadataTags: enabled
305+
TagSpecifications:
306+
- ResourceType: instance
307+
Tags:
308+
- Key: Project
309+
Value: UID2
310+
- ResourceType: volume
311+
Tags:
312+
- Key: Project
313+
Value: UID2
314+
Tags:
315+
- Key: Project
316+
Value: UID2
264317
AutoScalingGroup:
265318
Type: AWS::AutoScaling::AutoScalingGroup
266319
DependsOn:
@@ -283,6 +336,9 @@ Resources:
283336
- Key: Name
284337
Value: 'UID2 Instance'
285338
PropagateAtLaunch: true
339+
- Key: Project
340+
Value: UID2
341+
PropagateAtLaunch: true
286342
CreationPolicy:
287343
ResourceSignal:
288344
Count: 1

0 commit comments

Comments
 (0)