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 and tools ................................................................................................................... 4

Get started ....................................................................................................................................... 6

Prerequisites .................................................................................................................................................. 7

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

Next steps ................................................................................................................................................. 8

Install/Update ................................................................................................................................................ 8

AWS CLI install and update instructions ............................................................................................ 9

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

Next steps ............................................................................................................................................... 23

Past releases ................................................................................................................................................ 23

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

Next steps ............................................................................................................................................... 41

Build and install from source .................................................................................................................. 41

Why build from source? ...................................................................................................................... 42

Quicksteps .............................................................................................................................................. 42

Step 1: Setup all requirements .......................................................................................................... 45

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

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

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 ..............................................................

56

58

58

61

61

62

62

62

iii

AWS Command Line Interface

User Guide for Version 2

Run the o?cial images ........................................................................................................................ 63

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

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

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

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

Shorten the docker run command .................................................................................................... 72

Setup ............................................................................................................................................................. 75

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 ..................................................................................................................

75

76

85

86

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

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

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

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

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

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

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

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

Supported config ?le settings ...................................................................................................... 104

Environment Variables ............................................................................................................................ 123

How to set environment variables .................................................................................................. 123

AWS CLI supported environment variables ................................................................................... 124

Command line options ........................................................................................................................... 135

How to use command line options ................................................................................................ 135

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

Common uses of command line options ....................................................................................... 140

Command completion ............................................................................................................................ 141

How it works ....................................................................................................................................... 141

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

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

Retries ......................................................................................................................................................... 147

Available retry modes ........................................................................................................................ 147

Con?guring a retry mode ................................................................................................................. 150

Viewing logs of retry attempts ....................................................................................................... 151

Use an HTTP proxy .................................................................................................................................. 152

iv

AWS Command Line Interface

User Guide for Version 2

Using the examples ............................................................................................................................ 152

Authenticating to a proxy ................................................................................................................. 153

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

Troubleshooting .................................................................................................................................. 155

Endpoints ................................................................................................................................................... 155

Set endpoint for a single command ............................................................................................... 155

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

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

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

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

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

Authentication and access credentials ....................................................................................... 203

Con?guration and credential precedence ........................................................................................... 204

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

IAM Identity Center authentication ..................................................................................................... 205

Prerequisites ........................................................................................................................................ 206

Con?gure your pro?le with the aws configure sso wizard ............................................... 207

Con?gure only your sso-session section with aws configure sso-session

wizard .................................................................................................................................................... 210

Manual con?guration using the config ?le ................................................................................ 210

Sign in to an IAM Identity Center session ..................................................................................... 213

Run a command with your IAM Identity Center pro?le ............................................................. 214

Sign out of your IAM Identity Center sessions ............................................................................. 214

Troubleshooting .................................................................................................................................. 214

Related resources ................................................................................................................................ 215

IAM Identity Center concepts .......................................................................................................... 215

Tutorial: AWS IAM Identity Center and Amazon S3 .................................................................... 219

Short-term credentials ............................................................................................................................ 225

IAM roles .................................................................................................................................................... 226

Prerequisites ........................................................................................................................................ 226

Overview of using IAM roles ............................................................................................................ 226

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

Using MFA ............................................................................................................................................ 230

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

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

Assume role with web identity ........................................................................................................ 232

v

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

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

Google Online Preview   Download