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

83

84

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

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

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

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

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

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

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

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

84

85

86

86

94

95

96

99

Supported config ?le settings ...................................................................................................... 102

Environment Variables ............................................................................................................................ 120

How to set environment variables .................................................................................................. 121

AWS CLI supported environment variables ................................................................................... 122

Command line options ........................................................................................................................... 131

How to use command line options ................................................................................................ 132

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

Common uses of command line options ....................................................................................... 137

Command completion ............................................................................................................................ 138

How it works ....................................................................................................................................... 138

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

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

Retries ......................................................................................................................................................... 144

Available retry modes ........................................................................................................................ 144

Con?guring a retry mode ................................................................................................................. 147

Viewing logs of retry attempts ....................................................................................................... 148

Use an HTTP proxy .................................................................................................................................. 149

iv

AWS Command Line Interface

User Guide for Version 2

Using the examples ............................................................................................................................ 149

Authenticating to a proxy ................................................................................................................. 150

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

Troubleshooting .................................................................................................................................. 152

Endpoints ................................................................................................................................................... 152

Set endpoint for a single command ............................................................................................... 152

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

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

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

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

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

Authentication and access credentials ....................................................................................... 193

Con?guration and credential precedence ........................................................................................... 194

Additional topics in this section ........................................................................................................... 195

IAM Identity Center authentication ..................................................................................................... 195

Con?gure automatic token refresh ................................................................................................. 196

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

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

Short-term credentials ............................................................................................................................ 212

IAM roles .................................................................................................................................................... 213

Prerequisites ........................................................................................................................................ 213

Overview of using IAM roles ............................................................................................................ 213

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

Using MFA ............................................................................................................................................ 217

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

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

Assume role with web identity ........................................................................................................ 219

Clearing cached credentials .............................................................................................................. 221

IAM users ................................................................................................................................................... 221

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

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

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

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

Prerequisites ........................................................................................................................................ 225

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

External credentials ................................................................................................................................. 227

v

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

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

Google Online Preview   Download