← 返回命令列表

Linux command

aws-cli 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Configure AWS credentials

aws configure

List S3 buckets

aws s3 ls

Copy file to S3

aws s3 cp [path/to/file] s3://[bucket]/[key]

Sync directory to S3

aws s3 sync [path/to/directory] s3://[bucket]/[prefix]

List EC2 instances

aws ec2 describe-instances

Get caller identity (verify credentials)

aws sts get-caller-identity

Invoke a Lambda function

aws lambda invoke --function-name [function_name] [output.json]

Use a specific profile

aws --profile [profile_name] s3 ls

说明

aws is the official command-line interface for Amazon Web Services, providing unified access to all AWS services. It enables managing cloud infrastructure, deploying applications, and automating operations from the terminal. The CLI uses credentials stored in ~/.aws/credentials and configuration in ~/.aws/config. Multiple profiles support working with different AWS accounts or roles. Commands follow the pattern aws service operation --parameters. Output can be formatted as JSON, YAML, text, or tables, and filtered using JMESPath queries with --query. The CLI supports shell completion and an interactive auto-prompt mode for discovering commands and parameters.

参数

configure
Interactive setup for credentials and default region.
--profile _name_
Use named profile from credentials file.
--region _region_
Override the default region.
--output _format_
Output format: json, yaml, text, table.
--query _expression_
JMESPath query to filter output.
--no-cli-pager
Disable paging of output.
--debug
Enable debug logging.
--dry-run
Preview operation without executing (supported commands).
--cli-auto-prompt
Enable interactive auto-prompt mode.

FAQ

What is the aws-cli command used for?

aws is the official command-line interface for Amazon Web Services, providing unified access to all AWS services. It enables managing cloud infrastructure, deploying applications, and automating operations from the terminal. The CLI uses credentials stored in ~/.aws/credentials and configuration in ~/.aws/config. Multiple profiles support working with different AWS accounts or roles. Commands follow the pattern aws service operation --parameters. Output can be formatted as JSON, YAML, text, or tables, and filtered using JMESPath queries with --query. The CLI supports shell completion and an interactive auto-prompt mode for discovering commands and parameters.

How do I run a basic aws-cli example?

Run `aws configure` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does configure do in aws-cli?

Interactive setup for credentials and default region.