Make sure the user roles that need to access the instance have ssm:StartSession
and ssm:TerminateSession
permissions granted.
Created
July 21, 2020 19:43
-
-
Save statik/bffe1b97beaf2ffc45ea1cdf449bd8e0 to your computer and use it in GitHub Desktop.
setting up ssm access to ec2 instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export DEBIAN_FRONTEND=noninteractive | |
apt update | |
# Install cfn tools | |
apt install -y python-pip | |
apt install -y python-setuptools | |
cd /tmp/ || return | |
wget https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz | |
pip install aws-cfn-bootstrap-latest.tar.gz | |
# Install ssm | |
mkdir /tmp/ssm | |
cd /tmp/ssm || return | |
wget https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_amd64/amazon-ssm-agent.deb | |
sudo dpkg -i amazon-ssm-agent.deb | |
sudo systemctl enable amazon-ssm-agent | |
sudo systemctl start amazon-ssm-agent | |
/usr/local/bin/cfn-signal -e $? --resource kindlyInstance \ | |
--stack ${AWS::StackName} \ | |
--region ${AWS::Region} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment