Skip to content

AWS CLI

aws-meme.png

Setup

  • aws configure sso
    • name your profile default
    • so that you don't need to specify --profile every time you use aws-cli

Login

  • aws sso login --profile "profileName"
    • the default profile is default
  • Set the AWS_PROFILE=default env var

Install SSM

aws ssm start-session \
  --target "container-id-ec2, like i-0373fb85e5fbc7d8e" \
  --document-name AWS-StartPortForwardingSession \
  --parameters '{"portNumber":["22"],"localPortNumber":["56789"]}'

On Windows

aws ssm start-session --target "container-id-ec2, like i-0373fb85e5fbc7d8e" --document-name AWS-StartPortForwardingSession --parameters "{\"portNumber\":[\"22\"],\"localPortNumber\":[\"56789\"]}"
ssh -p 56789 root@localhost

Last update: 2023-04-24