Przejdź do głównej zawartości

Wnioski

CloudFormation template

In this template we can:

  • apply a public or private solution
  • update SSM Session Manager Preferences with Lambda or EC2.
  • automatically clean the S3 bucket before removing the stack

Creat stack

  • Basic without changes for SSM Session Manager preferences, without logging and encryption and with public access:
aws cloudformation create-stack --stack-name exampleEC2SSMSessionManager --template-body file://EC2SSMSessionManager.yml --capabilities CAPABILITY_NAMED_IAM
  • SSM Preferences update and S3 cleanup during bucket removal:
aws cloudformation create-stack --stack-name exampleEC2SSMSessionManager --template-body file://exampleEC2SSMSessionManager.yml --capabilities CAPABILITY_NAMED_IAM  --parameters ParameterKey=UpdateSMPreferences,ParameterValue=true ParameterKey=EmptyBucketBeforeDelete,ParameterValue=true 

Update stack

  • SSM Preferences update and S3 cleanup during bucket removal:
aws cloudformation create-stack --stack-name exampleEC2SSMSessionManager --template-body file://exampleEC2SSMSessionManager.yml --capabilities CAPABILITY_NAMED_IAM  --parameters ParameterKey=UpdateSMPreferences,ParameterValue=true ParameterKey=EmptyBucketBeforeDelete,ParameterValue=true 

Delete stack

  • Delete stack
aws cloudformation delete-stack --stack-name exampleEC2SSMSessionManager