$linuxjunkies
>

aws(1)

AWS Command Line Interface for managing Amazon Web Services resources from the terminal.

UbuntuDebianFedoraArch

Synopsis

aws [OPTIONS] <service> [<command>] [<subcommand>] [PARAMETERS]

Description

The AWS CLI is a unified tool for interacting with AWS services. It allows you to control multiple AWS services from the command line and automate them through scripts.

Commands are structured as aws service command subcommand, for example aws ec2 describe-instances or aws s3 cp file.txt s3://bucket/. Each service has its own set of operations and parameters.

Configuration is stored in ~/.aws/credentials and ~/.aws/config. You can use multiple named profiles for different AWS accounts or roles.

Common options

FlagWhat it does
--profile PROFILEUse a specific named profile from credentials and config files
--region REGIONSet AWS region (e.g., us-east-1, eu-west-1)
--output FORMATOutput format: json (default), text, table, or yaml
--query QUERYFilter output using JMESPath syntax
--endpoint-url URLOverride default endpoint URL (useful for S3 or LocalStack)
--no-sign-requestDo not sign the request (for public S3 buckets)
--debugEnable debug logging for troubleshooting
--versionDisplay AWS CLI version

Examples

Copy a local file to an S3 bucket

aws s3 cp myfile.txt s3://my-bucket/

List all EC2 instances in a region with table formatting

aws ec2 describe-instances --region us-east-1 --output table

Recursively list all objects in an S3 bucket

aws s3 ls s3://my-bucket/ --recursive

List all IAM usernames, extracting only the username field

aws iam list-users --query 'Users[*].UserName' --output text

Scan a DynamoDB table using the 'production' AWS profile

aws dynamodb scan --table-name my-table --profile production

Invoke a Lambda function synchronously and save response to file

aws lambda invoke --function-name my-function /tmp/output.json

Assume an IAM role and obtain temporary credentials

aws sts assume-role --role-arn arn:aws:iam::123456789:role/MyRole --role-session-name session1

Interactively configure credentials and default settings for a named profile

aws configure --profile myprofile

Related commands