- Launch Cloud9 IDE with SSM option
- When it launchers, open the Cloud9 IDE in the AWS Console
Install:
- AWS CLI
- Session Manager plugin for AWS CLI installed
Then follow these steps:
- On your client, generate (or use an existing) SSH key.
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa_c9
- On Cloud9, get your instance ID, e.g.,
curl [http://169.254.169.254/latest/meta-data/instance-id](http://169.254.169.254/latest/meta-data/instance-id)
- Add the public key to the authorized keys on the Cloud9 instance (
~/.ssh/authorized_keys
) - On your client machine, edit
~/.ssh/config
, adding:
Host i-* mi-*
ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
- Check that you can log in to your Cloud9 instance with the SSH client:
ssh -i ~/.ssh/id_rsa_c9 ec2-user@i-0ec1bd46c62784cff
- Create an entry in your
.ssh/config
(Note the AWS_PROFILE setting so you have credentials!)
Host i-0ec1bd46c62784cff
HostName i-0ec1bd46c62784cff
IdentityFile ~/.ssh/id_rsa_c9
User ec2-user
ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
- Finally, Connect to the host -
Cmd+Shift+P
→Connect to Host...
Now you’re coding! 😍