@@ -288,6 +288,28 @@ Conditions:
288288 !Not [Condition: CreateSubDomain]
289289
290290Resources :
291+ IamSSMRole :
292+ Type : " AWS::IAM::Role"
293+ Properties :
294+ RoleName : " EC2RoleForSSM"
295+ Description : " EC2 IAM role for SSM access"
296+ AssumeRolePolicyDocument :
297+ Version : " 2012-10-17"
298+ Statement :
299+ - Effect : " Allow"
300+ Principal :
301+ Service :
302+ - " ec2.amazonaws.com"
303+ Action :
304+ - " sts:AssumeRole"
305+ ManagedPolicyArns :
306+ - " arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
307+ EC2SSMInstanceProfile :
308+ Type : " AWS::IAM::InstanceProfile"
309+ Properties :
310+ InstanceProfileName : " EC2RoleForSSM"
311+ Roles :
312+ - Ref : " IamSSMRole"
291313 LambdaExecutionRole :
292314 Type : AWS::IAM::Role
293315 Properties :
@@ -344,6 +366,7 @@ Resources:
344366 - !Ref InstanceType
345367 - Arch
346368 InstanceType : !Ref InstanceType
369+ IamInstanceProfile : !Ref EC2SSMInstanceProfile
347370 SecurityGroupIds : !If
348371 - CreateSubDomain
349372 - - !GetAtt DLESecurityGroup.GroupId
@@ -451,6 +474,18 @@ Resources:
451474 sudo systemctl enable envoy
452475 sudo systemctl start envoy
453476 fi
477+
478+ # upgrade ssm agent version
479+ wget https://s3.us-east-1.amazonaws.com/amazon-ssm-us-east-1/amazon-ssm-agent/3.1.1575.0/amazon-ssm-agent-ubuntu-amd64.tar.gz
480+ tar -xf amazon-ssm-agent-ubuntu-amd64.tar.gz
481+ bash snap-install.sh
482+
483+ # Initialize CLI configuration
484+ su ubuntu -c '/usr/local/bin/dblab init \
485+ --environment-id=test \
486+ --url=http://localhost:2345 \
487+ --token=${DLEVerificationToken} \
488+ --insecure'
454489
455490 while ! echo "UI started" | nc localhost 2346; do sleep 10; done
456491 /opt/aws/bin/cfn-signal -e $? -d "DLE UI is available" -r "DLE Deploy Process Complete" '${WaitHandle}'
0 commit comments