Skip to content

AWS

aws-meme.png

Setup

  • aws configure sso
    • name it 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

Bastion Host

  • Machine in the Virtual Private Cloud (VPC)
  • always running
    • unlike EC2 instances
  • lets you port forward or ssh into EC2 instances easily

AWS ECS

ECS vs Kubernetes

  • ECS is like simple Kubernetes for EC2 only clusters
  • ECS orchestrates docker containers on EC2 clusters
  • ECS manages a lot for you so it's simpler than Kubernetes
  • Kubernetes is portable
    • if you want to move to Azure, GCP

AWS Fargate vs AWS ECS

ECS manages EC2 instances

Fargate is a level of abstraction higher

You manage tasks (2+ containers working together like backend and frontend container) 

Containers in the same task can communicate with each other via localhost


Last update: 2022-11-04