AWS Command Line Interface

User Guide for Version 2

AWS Command Line Interface

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

AWS Command Line Interface

AWS Command Line Interface: User Guide for Version 2

User Guide for Version 2

Copyright ? 2024 Amazon Web Services, Inc. and/or its affiliates. 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 affiliated with, connected to, or sponsored by Amazon.

AWS Command Line Interface

Table of Contents

User Guide for Version 2

......................................................................................................................................................... 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: Configuring the AWS CLI source installation .................................................................... 48 Step 3: Building the AWS CLI ............................................................................................................. 54 Step 4: Installing the AWS CLI ........................................................................................................... 55 Step 5: Verifying the AWS CLI installation ...................................................................................... 57 Workflow examples .............................................................................................................................. 57 Troubleshooting AWS CLI install and uninstall errors ................................................................... 60 Next steps ............................................................................................................................................... 60 Amazon ECR Public/Docker ..................................................................................................................... 61 Prerequisites ........................................................................................................................................... 61 Deciding between Amazon ECR Public and Docker Hub .............................................................. 61

iii

AWS Command Line Interface

User Guide for Version 2

Run the official images ........................................................................................................................ 62 Notes on interfaces and backwards compatibility of the official images .................................. 63 Use specific versions and tags ........................................................................................................... 63 Update to the latest official image ................................................................................................... 64 Share host files, credentials, environment variables, and configuration ................................... 65 Shorten the docker run command .................................................................................................... 71 Setup ............................................................................................................................................................. 74 Gather your credential information for programmatic access .................................................... 74 Setting up new configuration and credentials ............................................................................... 75 Using existing configuration and credentials files ......................................................................... 84 Configure the AWS CLI .................................................................................................................. 85 Configuration and credentials precedence ........................................................................................... 85 Additional topics in this section ............................................................................................................. 86 Configuration and credential file settings ............................................................................................ 87 Format of the configuration and credential files ........................................................................... 87 Where are configuration settings stored? ....................................................................................... 95 Using named profiles ........................................................................................................................... 96 Set and view configuration settings using commands ................................................................. 97 Setting new configuration and credentials command examples .............................................. 100 Supported config file 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 Configuring command completion on Linux or macOS ............................................................. 140 Configuring command completion on Windows ......................................................................... 144 Retries ......................................................................................................................................................... 145 Available retry modes ........................................................................................................................ 146 Configuring 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-specific endpoints .......................................................................................................... 157 Endpoint configuration and settings precedence ........................................................................ 200 Authentication and access credentials ....................................................................................... 201 Configuration and credential precedence ........................................................................................... 202 Additional topics in this section ........................................................................................................... 203 IAM Identity Center authentication ..................................................................................................... 203 Configure automatic token refresh ................................................................................................. 204 Configure legacy non-refreshable ................................................................................................... 211 Using an IAM Identity Center profile ............................................................................................. 217 Short-term credentials ............................................................................................................................ 220 IAM roles .................................................................................................................................................... 221 Prerequisites ........................................................................................................................................ 221 Overview of using IAM roles ............................................................................................................ 221 Configuring 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 Configure the AWS CLI ...................................................................................................................... 231 Use credentials for Amazon EC2 instance metadata ........................................................................ 233 Prerequisites ........................................................................................................................................ 233 Configuring a profile 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