AWS CLI Cheat Sheet

Common commands

General Configuration

  1. Configure AWS CLI with credentials: aws configure –> Enter Access KeySecret KeyRegion, and Output Format.

  2. Create a profile: aws configure –profile <profile-name>

  3. Use a specific profile: Add –profile <profile-name> to your commands.

S3 (Simple Storage Service)

  1. List all buckets: aws s3 ls

  2. Create a bucket: aws s3 mb s3://<bucket-name>

  3. Delete a bucket: aws s3 rb s3://<bucket-name> –force

  4. Upload a file: aws s3 cp <file-path> s3://<bucket-name>

  5. Download a file: aws s3 cp s3://<bucket-name>/<file-name> <destination-path>

  6. Sync a local directory to a bucket: aws s3 sync <local-directory> s3://<bucket-name>

EC2 (Elastic Compute Cloud)

  1. List instances: aws ec2 describe-instances

  2. Start an instance: aws ec2 start-instances –instance-ids <instance-id>

  3. Stop an instance: aws ec2 stop-instances –instance-ids <instance-id>

  4. Terminate an instance: aws ec2 terminate-instances –instance-ids <instance-id>

  5. List security groups: aws ec2 describe-security-groups

IAM (Identity and Access Management)

  1. List users: aws iam list-users

  2. Create a user: aws iam create-user –user-name <user-name>

  3. Delete a user: aws iam delete-user –user-name <user-name>

  4. Attach a policy to a user: aws iam attach-user-policy –user-name <user-name> –policy-arn <policy-arn>

  5. List groups: aws iam list-groups

CloudWatch

  1. List alarms: aws cloudwatch describe-alarms

  2. Delete an alarm: aws cloudwatch delete-alarms –alarm-names <alarm-name>

Lambda

  1. List Lambda functions: aws lambda list-functions

  2. Invoke a function: aws lambda invoke –function-name <function-name> <output-file>

  3. Delete a function: aws lambda delete-function –function-name <function-name>

Route53

  1. List hosted zones: aws route53 list-hosted-zones

  2. Create a hosted zone: aws route53 create-hosted-zone –name <domain-name>

  3. Delete a hosted zone: aws route53 delete-hosted-zone –id <zone-id>

SNS (Simple Notification Service)

  1. List topics: aws sns list-topics

  2. Publish a message: aws sns publish –topic-arn <topic-arn> –message “<message>”

  3. Subscribe to a topic: aws sns subscribe –topic-arn <topic-arn> –protocol <protocol> –notification-endpoint <endpoint>

DynamoDB

  1. List tables: aws dynamodb list-tables

  2. Describe a table: aws dynamodb describe-table –table-name <table-name>

  3. Delete a table: aws dynamodb delete-table –table-name <table-name>

EKS (Elastic Kubernetes Service)

  1. List clusters: aws eks list-clusters

  2. Describe a cluster: aws eks describe-cluster –name <cluster-name>

  3. Delete a cluster: aws eks delete-cluster –name <cluster-name>

References

[1] https://docs.aws.amazon.com/cli/latest/

[2] https://www.bluematador.com/learn/aws-cli-cheatsheet

[3] https://gist.github.com/apolloclark/b3f60c1f68aa972d324b

[4] https://dataguymichael.substack.com/p/the-ultimate-aws-cli-cheat-sheet

Nguyen Vu Ngoc Tung

I love making new professional acquaintances. Don't hesitate to contact me via nguyenvungoctung@gmail.com if you want to talk about information technology, education, and research on complex networks analysis (i.e., metabolic networks analysis), data analysis, and applications of graph theory. Specialties: researching and proposing innovative business approaches to organizations, evaluating and consulting about usability engineering, training and employee development, web technologies, software architecture.

https://www.itersdesktop.com/author/nvntung/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.