AWS Command Line Interface

User Guide for Version 2

AWS Command Line Interface

Copyright ? 2024 Amazon Web Services, Inc. and/or its a?liates. All rights reserved.

AWS Command Line Interface

User Guide for Version 2

AWS Command Line Interface: User Guide for Version 2

Copyright ? 2024 Amazon Web Services, Inc. and/or its a?liates. All rights reserved.

Amazon's trademarks and trade dress may not be used in connection with any product or service

that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any

manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are

the property of their respective owners, who may or may not be a?liated with, connected to, or

sponsored by Amazon.

AWS Command Line Interface

User Guide for Version 2

Table of Contents

......................................................................................................................................................... ix

About the AWS CLI .......................................................................................................................... 1

About AWS CLI version 2 ............................................................................................................................ 1

Maintenance and support for SDK major versions ................................................................................ 2

About Amazon Web Services ..................................................................................................................... 2

About the examples ..................................................................................................................................... 2

Additional documentation and resources ................................................................................................ 4

AWS CLI documentation and resources .............................................................................................. 4

Other AWS SDKs ..................................................................................................................................... 4

Get started ....................................................................................................................................... 5

Prerequisites .................................................................................................................................................. 6

Create an IAM or IAM Identity Center administrative account ...................................................... 6

Next steps ................................................................................................................................................. 7

Install/Update ................................................................................................................................................ 7

AWS CLI install and update instructions ............................................................................................ 8

Troubleshooting AWS CLI install and uninstall errors ................................................................... 21

Next steps ............................................................................................................................................... 22

Past releases ................................................................................................................................................ 22

Troubleshooting AWS CLI install and uninstall errors ................................................................... 40

Next steps ............................................................................................................................................... 40

Build and install from source .................................................................................................................. 40

Why build from source? ...................................................................................................................... 41

Quicksteps .............................................................................................................................................. 41

Step 1: Setup all requirements .......................................................................................................... 44

Step 2: Con?guring the AWS CLI source installation .................................................................... 48

Step 3: Building the AWS CLI ............................................................................................................. 54

Step 4: Installing the AWS CLI ...........................................................................................................

Step 5: Verifying the AWS CLI installation ......................................................................................

Work?ow examples ..............................................................................................................................

Troubleshooting AWS CLI install and uninstall errors ...................................................................

Next steps ...............................................................................................................................................

Amazon ECR Public/Docker .....................................................................................................................

Prerequisites ...........................................................................................................................................

Deciding between Amazon ECR Public and Docker Hub ..............................................................

55

57

57

60

60

61

61

61

iii

AWS Command Line Interface

User Guide for Version 2

Run the o?cial images ........................................................................................................................ 62

Notes on interfaces and backwards compatibility of the o?cial images .................................. 63

Use speci?c versions and tags ........................................................................................................... 63

Update to the latest o?cial image ................................................................................................... 64

Share host ?les, credentials, environment variables, and con?guration ................................... 65

Shorten the docker run command .................................................................................................... 71

Setup ............................................................................................................................................................. 74

Gather your credential information for programmatic access ....................................................

Setting up new con?guration and credentials ...............................................................................

Using existing con?guration and credentials ?les .........................................................................

Con?gure the AWS CLI ..................................................................................................................

74

75

84

85

Con?guration and credentials precedence ........................................................................................... 85

Additional topics in this section ............................................................................................................. 86

Con?guration and credential ?le settings ............................................................................................ 87

Format of the con?guration and credential ?les ........................................................................... 87

Where are con?guration settings stored? ....................................................................................... 95

Using named pro?les ........................................................................................................................... 96

Set and view con?guration settings using commands ................................................................. 97

Setting new con?guration and credentials command examples .............................................. 100

Supported config ?le settings ...................................................................................................... 103

Environment Variables ............................................................................................................................ 121

How to set environment variables .................................................................................................. 122

AWS CLI supported environment variables ................................................................................... 123

Command line options ........................................................................................................................... 133

How to use command line options ................................................................................................ 133

AWS CLI supported global command line options ...................................................................... 134

Common uses of command line options ....................................................................................... 139

Command completion ............................................................................................................................ 139

How it works ....................................................................................................................................... 140

Con?guring command completion on Linux or macOS ............................................................. 140

Con?guring command completion on Windows ......................................................................... 144

Retries ......................................................................................................................................................... 145

Available retry modes ........................................................................................................................ 146

Con?guring a retry mode ................................................................................................................. 148

Viewing logs of retry attempts ....................................................................................................... 149

Use an HTTP proxy .................................................................................................................................. 150

iv

AWS Command Line Interface

User Guide for Version 2

Using the examples ............................................................................................................................ 151

Authenticating to a proxy ................................................................................................................. 152

Using a proxy on Amazon EC2 instances ...................................................................................... 152

Troubleshooting .................................................................................................................................. 153

Endpoints ................................................................................................................................................... 153

Set endpoint for a single command ............................................................................................... 154

Set global endpoint for all AWS services ...................................................................................... 154

Set to use FIPs endpoints for all AWS services ............................................................................ 155

Set to use dual-stack endpoints for all AWS services ................................................................. 156

Set service-speci?c endpoints .......................................................................................................... 157

Endpoint con?guration and settings precedence ........................................................................ 200

Authentication and access credentials ....................................................................................... 201

Con?guration and credential precedence ........................................................................................... 202

Additional topics in this section ........................................................................................................... 203

IAM Identity Center authentication ..................................................................................................... 203

Con?gure automatic token refresh ................................................................................................. 204

Con?gure legacy non-refreshable ................................................................................................... 211

Using an IAM Identity Center pro?le ............................................................................................. 217

Short-term credentials ............................................................................................................................ 220

IAM roles .................................................................................................................................................... 221

Prerequisites ........................................................................................................................................ 221

Overview of using IAM roles ............................................................................................................ 221

Con?guring and using a role ........................................................................................................... 223

Using MFA ............................................................................................................................................ 225

Cross-account roles and external ID ............................................................................................... 226

Specifying a role session name for easier auditing ..................................................................... 227

Assume role with web identity ........................................................................................................ 227

Clearing cached credentials .............................................................................................................. 229

IAM users ................................................................................................................................................... 229

Step 1: Create your IAM user ........................................................................................................... 230

Step 2: Get your access keys ............................................................................................................ 230

Con?gure the AWS CLI ...................................................................................................................... 231

Use credentials for Amazon EC2 instance metadata ........................................................................ 233

Prerequisites ........................................................................................................................................ 233

Con?guring a pro?le for Amazon EC2 metadata ........................................................................ 234

External credentials ................................................................................................................................. 235

v

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download