AWS CLI | Important & Useful Commands
Tags: devops, aws, opensource, cloud
Published: 2023-10-15 17:33:38

**The AWS Command Line Interface (CLI) provides a wide range of commands for interacting with various AWS services and managing your AWS resources. Here's a list of some commonly used AWS CLI commands, grouped by their respective services or functions.**

[AWS CLI installation based on Operating System](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)

**AWS CLI Core Commands:**
- **aws configure:**
 Set up your AWS CLI configuration, including access key, secret key, default region, and output format.
- **aws help:**
 Get help and information on AWS CLI commands and their usage.

**Amazon EC2 (Elastic Compute Cloud):**
- **aws ec2 describe-instances:** List EC2 instances in your AWS account.
- **aws ec2 run-instances:** Launch a new EC2 instance.
- **aws ec2 terminate-instances:** Terminate one or more EC2 instances.

**Amazon S3 (Simple Storage Service):**
- **aws s3 ls:** List S3 buckets or objects.
- **aws s3 cp:** Copy files and directories to/from S3.
- **aws s3 rm:** Delete objects from S3.

**Amazon RDS (Relational Database Service):**
- **aws rds describe-db-instances:** List RDS database instances.
- **aws rds create-db-instance:** Create a new RDS database instance.
- **aws rds delete-db-instance:** Delete an RDS database instance.

**Amazon IAM (Identity and Access Management):**
- **aws iam create-user:** Create a new IAM user.
- **aws iam list-users:** List IAM users.
- **aws iam attach-user-policy:** Attach a managed policy to an IAM user.

**AWS Lambda:**
- **aws lambda create-function:** Create a new Lambda function.
- **aws lambda list-functions:** List Lambda functions in your AWS account.
- **aws lambda invoke:** Invoke a Lambda function.

**Amazon CloudWatch:**
- **aws cloudwatch put-metric-data:** Publish custom metrics to CloudWatch.
- **aws cloudwatch describe-alarms:** List CloudWatch alarms.
- **aws cloudwatch get-metric-statistics:** Get statistics for CloudWatch metrics.

**Amazon ECS (Elastic Container Service):**
- **aws ecs create-cluster:** Create a new ECS cluster.
- **aws ecs list-container-instances:** List container instances in an ECS cluster.
- **aws ecs run-task:** Run a new task on an ECS cluster.

**Amazon SQS (Simple Queue Service):**
- **aws sqs create-queue:** Create a new SQS queue.
- **aws sqs list-queues:** List SQS queues in your AWS account.
- **aws sqs send-message:** Send a message to an SQS queue.

**Amazon SNS (Simple Notification Service):**
- **aws sns create-topic:** Create a new SNS topic.
- **aws sns list-topics:** List SNS topics.
- **aws sns publish:** Publish a message to an SNS topic.

**Amazon DynamoDB:**
- **aws dynamodb create-table:** Create a new DynamoDB table.
- **aws dynamodb list-tables:** List DynamoDB tables.
- **aws dynamodb put-item:** Put an item into a DynamoDB table.

_Note_: To get specific information about a particular command, you can use the 'aws help' command followed by the command you want to learn more about. For example:
```
aws help ec2 describe-instances
```

_Certainly! Here are more AWS CLI commands for various AWS services:_

**Amazon VPC (Virtual Private Cloud):**
- **aws ec2 create-vpc:** Create a new Virtual Private Cloud (VPC).
- **aws ec2 describe-vpcs:** List VPCs in your AWS account.
- **aws ec2 create-subnet:** Create a new subnet within a VPC.

**Amazon SNS (Simple Notification Service):**
- **aws sns list-subscriptions:** List subscriptions to an SNS topic.
- **aws sns create-subscription:** Subscribe an endpoint (e.g., an email address or an SQS queue) to an SNS topic.

**AWS CloudFormation:**
- **aws cloudformation create-stack:** Create a new CloudFormation stack.
- **aws cloudformation list-stacks:** List CloudFormation stacks in your AWS account.
- **aws cloudformation describe-stack-events:** Describe events for a specific CloudFormation stack.

**AWS CloudFront (Content Delivery Network):**
- **aws cloudfront create-distribution:** Create a new CloudFront distribution.
- **aws cloudfront list-distributions:** List CloudFront distributions.
- **aws cloudfront create-invalidation:** Create an invalidation for a CloudFront distribution.

**AWS Elastic Beanstalk:**
- **aws elasticbeanstalk create-application:** Create a new Elastic Beanstalk application.
- **aws elasticbeanstalk create-environment:** Create a new Elastic Beanstalk environment.
- **aws elasticbeanstalk describe-environments:** Describe Elastic Beanstalk environments.

**AWS Glue (Data ETL Service):**
- **aws glue create-database:** Create a new AWS Glue database.
- **aws glue create-crawler:** Create an AWS Glue crawler to discover and catalog data.
- **aws glue start-job-run:** Start an AWS Glue job run.

**AWS Redshift (Data Warehouse):**
- **aws redshift create-cluster:** Create a new Amazon Redshift cluster.
- **aws redshift describe-clusters:** Describe Amazon Redshift clusters.
- **aws redshift modify-cluster:** Modify the properties of an Amazon Redshift cluster.

**AWS Kinesis (Real-time Data Streaming):**
- **aws kinesis create-stream:** Create a new Kinesis data stream.
- **aws kinesis list-streams:** List Kinesis data streams.
- **aws kinesis put-record:** Put a single data record into a Kinesis data stream.

**AWS Step Functions (Serverless Orchestration):**
- **aws stepfunctions create-state-machine:** Create a new Step Functions state machine.
- **aws stepfunctions list-state-machines:** List Step Functions state machines.
- **aws stepfunctions start-execution:** Start the execution of a Step Functions state machine.

**AWS Secrets Manager:**
- **aws secretsmanager create-secret:** Create a new secret in AWS Secrets Manager.
- **aws secretsmanager list-secrets:** List secrets stored in AWS Secrets Manager.
- **aws secretsmanager get-secret-value:** Retrieve the value of a secret.

Follow me on [Linkedin](https://www.linkedin.com/in/shamim-ansari7/) | [Twitter](https://twitter.com/shamim_faizi786) for more such contents