AWS CLI
awscli to interact with AWS
Install
sh
brew install awscli
Configure credentials from the access keys (generate them from aws console)
sh
aws configure
Show Account
sh
aws sts get-caller-identity
List all S3 buckets
sh
aws s3 ls
Create repo and push a local image to ecr
sh
aws ecr create-repository --repository-name test
aws ecr list-images --repository-name test
aws ecr get-login-password --region us-east-1
aws ecr --region us-east-1 | docker login -u AWS -p <password-from-above-command> <ecr-repo-uri>
docker tag <source-image-name-with-tag> <ecr-repo-uri>
docker push <ecr-repo-uri>
Fargate
sh
aws ecs create-cluster --cluster-name fargate-cluster
aws ecs list-task-definitions
aws ecs list-services --cluster fargate-cluster
aws ecs list-tasks --cluster fargate-cluster --service fargate-service
aws ecs describe-tasks --cluster fargate-cluster --tasks arn:aws:ecs:<region>:<user-id>:task/service/EXAMPLE
aws ec2 describe-network-interfaces --network-interface-id eni-0faa022e38d7c6bc6
aws ecs delete-service --cluster fargate-cluster --service fargate-service --force
aws ecs delete-cluster --cluster fargate-cluster