AWS Command Line Interface (AWS CLI)
Cloud service · AWS · Updated

AWS Command Line Interface (AWS CLI)

In short

The AWS Command Line Interface (AWS CLI) is a unified tool that allows you to manage and automate AWS services directly from the terminal or command prompt.

Cloud Services Hub →

Free AWS Command Line Interface (AWS CLI) tools

10 key features of AWS Command Line Interface (AWS CLI)

The AWS Command Line Interface (AWS CLI) facilitates multi-service control, script-based automation, consistent management across services, supports various output formats, integrates with AWS SDKs, is backed by extensive documentation, and is built for scalable service administration.

01
Cross-Service Control

The AWS CLI allows users to control multiple AWS services from the command line and automate them through scripts.

02
Consistency Across Services

Provides a consistent syntax and set of commands for managing various AWS services, simplifying the process of working with AWS resources.

03
Automation with Scripts

Enables the automation of administrative tasks via scripting, allowing for efficient infrastructure management and deployment processes.

04
Support for Output Formats

Supports multiple output formats including JSON, text, and table, allowing users to customize the display of results and integrate with other tools and systems.

05
Integration with AWS SDKs

Seamlessly integrates with AWS SDKs, enabling developers to use the AWS CLI in conjunction with other programming languages and SDK features.

06
Extensive Documentation and Support

Comes with comprehensive documentation and supports a wide range of AWS services, making it easier for users to find help and examples.

07
Built for Scalability

Designed to handle administration of services at scale, from small-scale applications to large enterprise environments.

08
Embedded Python Interpreter

AWS CLI version 2 includes an embedded Python interpreter and does not require a separate Python installation.

09
Auto-Prompt

When enabled, AWS CLI version 2 prompts for commands, parameters, and resources when you run an aws command.

10
Interactive Command Wizards

AWS CLI version 2 provides wizards that guide you through constructing certain commands.

Where AWS Command Line Interface (AWS CLI) is used

AWS CLI use cases encompass automating backup and snapshot management, streamlining deployment processes, performing batch file operations on Amazon S3, managing AWS resources across multiple regions and accounts, and querying service information for reporting.

  1. 01
    Automating Backup and Snapshot Management

    Organizations can utilize the AWS CLI to automate the creation, deletion, and management of backups and snapshots of their AWS services such as Amazon EC2 instances and Amazon RDS databases. This can significantly reduce the risk of data loss while saving time and ensuring compliance with data retention policies.

  2. 02
    Streamlining Deployment Processes

    Developers and DevOps engineers can use the AWS CLI to automate and streamline their software deployment processes. By integrating AWS CLI commands into scripts or CI/CD pipelines, users can programmatically manage the deployment of applications across various AWS services such as AWS Elastic Beanstalk, AWS Lambda, or Amazon ECS, ensuring consistent and reproducible deployments.

  3. 03
    Batch File Operations on Amazon S3

    The AWS CLI can be used to perform batch operations on Amazon S3, including uploading, downloading, copying, and deleting large numbers of files. This capability is especially useful for managing data backups, log files, or deploying static websites and can be more efficient than using the Amazon S3 web interface for large-scale operations.

  4. 04
    Managing AWS Resources Across Multiple Regions and Accounts

    With the AWS CLI, users can manage resources across different AWS regions and accounts by specifying the account and region within their commands. This feature is essential for businesses operating on a global scale, allowing them to easily manage their infrastructure and ensure regional compliance and data residency requirements are met.

  5. 05
    Querying AWS Service Information and Generating Reports

    The AWS CLI supports powerful querying and filtering capabilities that allow users to retrieve specific information about their AWS environment. By using these features, IT teams can generate reports on resource usage, costs, security settings, and compliance statuses, aiding in decision-making and governance.

How AWS Command Line Interface (AWS CLI) is priced

Using AWS CLI is free, but costs arise from the commands affecting AWS services and potential data transfer fees.

Cost of Commands Executed

The AWS Command Line Interface (AWS CLI) itself is free to use, but charges may apply based on the AWS services you interact with using the CLI. Costs are determined by the specific commands executed and the resources they affect. Usage of AWS services through the CLI is billed the same as usage through the AWS Management Console or APIs.

Data Transfer Fees

There may be data transfer fees associated with the use of the AWS CLI, especially when moving data in and out of AWS services across different regions or out to the internet. These fees are based on the volume of data transferred and the service’s data transfer pricing.

Services AWS Command Line Interface (AWS CLI) works with

Amazon EC2Amazon EC2

The AWS CLI can retrieve temporary credentials from an EC2 instance's attached IAM role through the instance metadata service. This lets scripts running on the instance authenticate without storing long-term access keys.

Amazon Elastic Container Service (Amazon ECS)Amazon Elastic Container Service (Amazon ECS)

The AWS CLI supports the ECS container credentials provider, allowing commands inside a task to use temporary credentials from its task IAM role. This avoids embedding access keys in container images or task definitions.

Amazon Elastic Kubernetes Service (Amazon EKS)Amazon Elastic Kubernetes Service (Amazon EKS)

The AWS CLI can obtain temporary credentials through EKS Pod Identity or IAM roles for service accounts. Commands running inside a configured pod use the pod's assigned AWS permissions without requiring long-term access keys.

AWS Cloud9AWS Cloud9

AWS Cloud9 development environments include the AWS CLI. In supported EC2 environments, Cloud9 can supply AWS managed temporary credentials for CLI commands run in the IDE terminal.

AWS CloudShellAWS CloudShell

AWS CloudShell includes AWS CLI version 2 and supplies credentials based on the identity used to sign in to the AWS Management Console. You can run authenticated CLI commands from the browser without installing the tool or configuring access keys.

AWS CodeBuildAWS CodeBuild

CodeBuild's AWS-managed build images include the AWS CLI, allowing buildspec commands to perform AWS operations during a build. The CLI can use temporary credentials associated with the build's service role.

AWS IAM Identity Center (AWS Single Sign-On)AWS IAM Identity Center (AWS Single Sign-On)

AWS CLI version 2 supports IAM Identity Center sign-in through SSO profiles. It obtains and refreshes temporary credentials for assigned AWS accounts and roles, allowing users to run commands without managing long-term access keys.

AWS Identity and Access Management (IAM)AWS Identity and Access Management (IAM)

The AWS CLI uses IAM credentials and permissions to authenticate and authorize its requests. Named profiles can reference IAM user credentials or configure IAM roles to assume for different workloads and accounts.

AWS Security Token Service (AWS STS)AWS Security Token Service (AWS STS)

The AWS CLI can automatically call AWS STS to assume a role configured in a profile, cache the resulting temporary credentials, and refresh them as needed. It also supports web identity role profiles and role assumption that requires an MFA code.

What is AWS Command Line Interface (AWS CLI)

3 min read

The AWS Command Line Interface (CLI) is a powerful tool provided by Amazon Web Services (AWS) to manage and interact with AWS services directly from the command line. It combines a wide range of capabilities that enable users to control multiple AWS services and automate them through scripts. 

The AWS CLI brings the vast AWS ecosystem right to your terminal, offering a consistent method for managing AWS resources. Designed to work on various operating systems such as Windows, macOS, and Linux, the AWS CLI offers flexibility and convenience for developers, system administrators, and cloud practitioners alike. 

AWS CLI version 2 can also run in a container using the official image available through Amazon ECR Public or Docker. AWS supports and maintains this image, allowing container-based use without managing the CLI installation yourself.

By default, the AWS CLI sends requests to AWS services using HTTPS on TCP port 443, so the environment running it must allow outbound connections on that port.

One of the key advantages of using the AWS CLI is its ability to streamline complex tasks that would otherwise require navigating through the AWS Management Console. For instance, with a single command line instruction, users can launch instances, create buckets, upload files, and much more. This immediate access to AWS services enhances productivity and allows for quicker deployment and management of resources. 

AWS CLI version 2 enables a client-side pager by default, sending output through the operating system's default pager program.

Furthermore, the AWS CLI supports direct scripting which makes it invaluable for automating repetitive tasks or deploying infrastructure as code, thereby promoting efficient operations and DevOps practices. The AWS CLI is designed around a unified syntax. Commands follow a predictable structure, allowing users to intuitively interact with different services without needing to learn a unique syntax for each. 

Additionally, the AWS CLI is extensible, meaning users can add support for new services provided by AWS as they are released, ensuring that the tool remains relevant and useful as the AWS platform evolves. Security within the AWS CLI is managed through the use of Access Keys and Secret Access Keys, or more securely through IAM Roles and Identity Federation, ensuring actions initiated via the CLI are authenticated and authorized. This is crucial in maintaining the integrity and security of AWS resources. 

AWS CLI v1 entered maintenance mode on August 5, 2026 and will reach end-of-support on July 15, 2027. Its releases are limited to critical bug fixes and security issues; it no longer receives API updates for new or existing services or support for new Regions. AWS recommends migrating to AWS CLI version 2.

You can also authenticate using your existing AWS Management Console sign-in credentials by running aws login in the latest AWS CLI. A browser-based authentication flow generates temporary credentials for local development tools.

Another compelling aspect of the AWS CLI is its integration capabilities. It can be used in conjunction with other tools and scripts, providing a bridge between AWS services and third-party applications or services. This makes it an essential tool for building complex cloud environments that require interaction between different services and platforms. 

In essence, the AWS CLI is a testament to AWS's commitment to providing tools that enhance efficiency, security, and manageability for cloud-based resources. It enables a scalable and secure method of managing AWS services, which is critical for businesses and individuals aiming to leverage the full potential of cloud computing. Whether you're launching a single EC2 instance or managing an entire fleet of AWS resources, the AWS CLI stands as an indispensable tool in the arsenal of modern cloud computing practices.

AWS architecture icons are the property of Amazon Web Services. BlowStack is not affiliated with or endorsed by AWS.