AWS CLI Commands
The following are some of the AWS CLI Commands:
1. Configure AWS CLI
- The following command is used for configuring AWS CLI with credentials such as access key, secret key, and output format.
aws configure
2. List Amazon S3 Buckets
The following is used for listing Amazon S3 Buckets that are available in your AWS Account:
aws s3 ls
3. Copy Files to Amazon S3
- The following command is used for copying the file on your local system to an Amazon S3 bucket.
aws s3 cp localfile.txt s3://bucketname/
4. Creating an Amazon S3 Bucket
The following command is used to create an Amazon S3 Bucket:
aws s3 mb s3://mybucket
5. Delete an Amazon S3 Bucket
The following command is used to delete an Amazon S3 Bucket:
aws s3 rb s3://mybucket --force
6. List Amazon EC2 Instances
- The following command is used for listing the Amazon EC2 instances by describing them:
aws ec2 describe-instances
7. Start an Amazon EC2 Instance
- The following command is used to start an Amazon EC2 Instance by specifying its instance ID:
aws ec2 start-instances --instance-ids i-1234567890abcdef0
8. Stop an Amazon EC2 Instance
- The following command is used to stop an Amazon EC2 Instance by specifying the respective instance ID:
aws ec2 stop-instances --instance-ids i-1234567890abcdef0
9. List Lambda Functions
- The following command is used to list the lambda functions:
aws lambda list-functions
10. Invoke a Lambda Function
The following command is used to invoke a AWS lambda function and it outputs the response to a file.
aws lambda invoke --function-name myfunction out.txt
11. Create A DynamoDB Table
The following command is used to create a DynamoDB table with specifying the attributes and provisioning the throughput.
aws dynamodb create-table --table-name mytable --attribute-definitions AttributeName=Id,AttributeType=S --key-schema AttributeName=Id,KeyType=HASH --provisioned-throughput
ReadCapacityUnits=1,WriteCapacityUnits=1
12. List CloudFormation Stacks
- The following command is used to list the CloudFormation stacks:
aws cloudformation list-stacks
13. Deploy CloudFormation Stack
- The following command is used for deploying a CloudFormation stack with the template.yaml file that is defined with configurations.
aws cloudformation deploy --template-file template.yaml --stack-name my-stack --capabilities CAPABILITY_IAM
14. List All RDS Instances
- The following command is used for all the Amazon RDS instances:
aws rds describe-db-instances
What Is AWS CLI (Command Line Interface) ? Complete Guide
AWS CLI is a command line tool that is used for managing the AWS Services from the command line. On downloading the AWS CLI software and configuring it with your AWS credentials you can control the AWS services from the command line and can automate the work through scripts. Whether you are launching EC2 instances, attaching the EBS Volumes, or managing the S3 buckets you can easily simplify these tasks and help in performing the tasks effectively.
Table of Content
- What is AWS CLI?
- How Does AWS CLI Work?
- How to Install AWS CLI? A Step-By-Step Guide
- What are the differences between AWS Console and AWS CLI?
- Difference between AWS shell and AWS CLI
- Difference Between AWS CLI and AWS SDK
- AWS Command Line Interface (CLI) Usage
- How to use AWS EC2, EBS, and S3 Services in AWS CLI? A Step-By-Step Guide
- AWS CLI Commands
- Features of AWS CLI
- Benefits of AWS CLI
- AWS CLI – FAQs