Aws cli для windows

Интерфейс командной строки AWS

Интерфейс командной строки AWS – это единый инструмент для управления сервисами AWS. Загрузив всего одно средство, вы сможете контролировать множество сервисов AWS из командной строки и автоматизировать их с помощью скриптов.

В интерфейсе командной строки AWS представлен новый набор простых файловых команд для эффективного получения и отправки файлов в Amazon S3.

Windows
Загрузите и запустите 64- или 32-разрядный установщик для Windows.

Mac и Linux
Требуется Python 2.6.5 или более поздней версии.
Установите с помощь pip.

Amazon Linux
Образы Amazon Linux AMI поставляются с предварительно установленным интерфейсом командной строки AWS.

Примечания к выпуску
Ознакомьтесь с примечаниями к выпуску для получения дополнительной информации о последней версии.

aws-shell (ознакомительный режим для разработчика)

aws-shell – это программа, представляющая собой удобную и эффективную командную оболочку, которая поможет как новым, так и опытным пользователям интерфейса командной строки AWS. Ниже перечислены основные возможности программы.

  • Автозаполнение с нечетким поиском для:
    • команд (например, ec2, describe-instances, sqs, create-queue);
    • параметров (например, —instance-ids, —queue-url);
    • идентификаторов ресурсов (например, ID инстансов Amazon EC2, URL очередей Amazon SQS, названия тем Amazon SNS).
  • Динамическая встроенная документация:
    • во время набора команд и параметров на экран выводится соответствующая документация.
  • Выполнение команд оболочки ОС:
    • использование простых команд ОС, таких как cat, ls и cp, а также стыкование потоков ввода и вывода без необходимости покидать оболочку.
  • Экспорт выполненных команд в текстовый редактор.

За дополнительными сведениями обратитесь к соответствующей публикации в блоге AWS Command Line Interface blog.

Использование

В руководстве пользователя интерфейса командной строки AWS описывается установка и настройка этого инструмента. Завершив подготовку, вы сможете отправлять вызовы сервисам AWS из командной строки.

В командной строке можно получить справку для просмотра поддерживаемых сервисов,

Installing, updating, and uninstalling the AWS CLI version 2 on Windows

This section describes how to install, update, and remove the AWS CLI version 2 on Windows.

AWS CLI versions 1 and 2 use the same aws command name. If you have both versions installed, your computer uses the first one found in your search path. If you previously installed AWS CLI version 1, we recommend that you do one of the following to use AWS CLI version 2:

Recommended – Uninstall AWS CLI version 1 and use only AWS CLI version 2. For uninstall instructions, determine the method you used to install AWS CLI version 1 and follow the appropriate uninstall instructions for your operating system in Installing, updating, and uninstalling the AWS CLI version 1

Use your operating system’s ability to create a symbolic link (symlink) or alias with a different name for one of the two aws commands. For example, you can use a symbolic link or alias on Linux and macOS, or DOSKEY on Windows.

For information on breaking changes between version 1 and version 2, see Breaking changes – Migrating from AWS CLI version 1 to version 2.

Topics

Prerequisites

Before you can install or update the AWS CLI version 2 on Windows, be sure you have the following:

A 64-bit version of Windows XP or later.

Admin rights to install software

Install or update the AWS CLI version 2 on Windows using the MSI installer

Download the AWS CLI MSI installer for Windows (64-bit):

For a specific version of the AWS CLI: Append a hyphen and the version number to the filename. For this example the filename for version 2.0.30 would be AWSCLIV2-2.0.30.msi resulting in the following link https://awscli.amazonaws.com/AWSCLIV2-2.0.30.msi . For a list of versions, see the AWS CLI version 2 changelog on GitHub.

To update your current installation of AWS CLI version 2 on Windows, download a new installer each time you update to overwrite previous versions. AWS CLI is updated regularly. To see when the latest version was released, see the AWS CLI version 2 changelog on GitHub.

Run the downloaded MSI installer and follow the on-screen instructions. By default, the AWS CLI installs to C:\Program Files\Amazon\AWSCLIV2 .

Читайте также:  Как решить проблему синего экрана windows

To confirm the installation, open the Start menu, search for cmd to open a command prompt window, and at the command prompt use the aws —version command.

Don’t include the prompt symbol ( C:\> ) when you type a command. These are included in program listings to differentiate commands that you type from output returned by the AWS CLI. The rest of this guide uses the generic prompt symbol ( $ ), except in cases where a command is Windows-specific. For more information about how we format code examples, see Using the AWS CLI examples.

If Windows is unable to find the program, you might need to close and reopen the command prompt window to refresh the path, or add the installation directory to your PATH environment variable manually.

Uninstall the AWS CLI version 2 from Windows

Open Programs and Features by doing one of the following:

Open the Control Panel, and then choose Programs and Features.

Open a command prompt, and then enter the following command.

Select the entry named AWS Command Line Interface, and then choose Uninstall to launch the uninstaller.

Confirm that you want to uninstall the AWS CLI.

Installing the AWS SAM CLI on Windows

Follow these steps to install and configure the prerequisites for using the AWS SAM command line interface (CLI) on your Windows host:

Create an AWS Identity and Access Management (AWS) account.

Configure IAM permissions and AWS credentials.

Install Docker. Note: Docker is a prerequisite only for testing your application locally or using the —use-container option.

Install the AWS SAM CLI.

Step 1: Create an AWS account

Step 2: Configure IAM permissions and AWS credentials

The IAM user that you use with AWS SAM must have sufficient permissions to make necessary AWS service calls and manage AWS resources. The simplest way to ensure that a user has sufficient permissions is to grant administrator privileges to them. For more information, see Creating your first IAM admin user and group in the IAM User Guide.

If you don’t want to grant administrator privileges to users who use the AWS Command Line Interface (AWS CLI), you can grant restricted sets of permissions to them. For more information, see Permissions.

In addition, to enable the AWS SAM CLI to make AWS service calls, you must set up AWS credentials. For more information, see Setting up AWS credentials.

Step 3: Install Docker (optional)

Docker is a prerequisite only for testing your application locally and for building deployment packages using the —use-container option. If you don’t plan to use these features initially, you can skip this section or install Docker at a later time.

Docker is an application that runs containers on your Linux machines. AWS SAM provides a local environment that’s similar to AWS Lambda to use as a Docker container. You can use this container to build, test, and debug your serverless applications.

To run serverless projects and functions locally with the AWS SAM CLI, you must have Docker installed and working. The AWS SAM CLI uses the DOCKER_HOST environment variable to contact the Docker daemon. The following steps describe how to install, configure, and verify a Docker installation to work with the AWS SAM CLI.

Docker Desktop supports the most recent Windows operating system. For legacy versions of Windows, the Docker Toolbox is available. Choose your version of Windows for the correct Docker installation steps:

To install Docker for Windows 10, see Install Docker Desktop for Windows .

To install Docker for older versions of Windows, see Install Docker Toolbox on Windows .

Configure your shared drives.

The AWS SAM CLI requires that the project directory, or any parent directory, is listed in a shared drive. In some cases you must share your drive in order for Docker to function properly.

Читайте также:  Windows graphic card test

If you’re using Windows 10 in Hyper-V mode, see Docker File Sharing .

To share drives on older versions of Windows, see Add Shared Directories .

Verify the installation.

After Docker is installed, verify that it’s working. Also confirm that you can run Docker commands from the command line (for example, docker ps ). You don’t need to install, fetch, or pull any containers—the AWS SAM CLI does this automatically as required.

Step 4: Install the AWS SAM CLI

Windows Installer (MSI) files are the package installer files for the Windows operating system.

Follow these steps to install the AWS SAM CLI using the MSI file.

Install the AWS SAM CLI 64-bit .

Verify the installation.

After completing the installation, verify it by opening a new command prompt or PowerShell prompt. You should be able to invoke sam from the command line.

You should see output like the following after successful installation of the AWS SAM CLI:

To download sample applications using the sam init command, you must also install Git. For instructions, see Installing Git .

You’re now ready to start development.

Uninstalling

To uninstall the AWS SAM CLI using Windows Settings, follow these steps:

From the Start menu, search for «Add or remove programs».

Select the entry named AWS SAM Command Line Interface and choose Uninstall to launch the uninstaller.

Confirm that you want to uninstall the AWS SAM CLI.

Nightly build

A nightly build of the AWS SAM CLI is available for you to install. Once installed, you can use the nightly build using the sam-nightly command. You can install and use both the production and nightly build versions of the AWS SAM CLI at the same time.

The nightly build contains a pre-release version of AWS SAM CLI code that may be less stable than the production version. Note that the nightly build does not contain pre-release version of the build image, so building a serverless application with the —use-container option uses the latest production version of the build image.

The nightly build is available with this download link: AWS SAM CLI nightly build . To install the nightly build version of the AWS SAM CLI, perform the same steps as in the Step 4: Install the AWS SAM CLI section earlier in this topic, but use the nightly build download link instead.

To verify you have installed the nightly build version, run the sam-nightly —version command. The output of this command is in the form 1.X.Y.dev , for example:

Next steps

You’re now ready to begin building your own serverless applications using AWS SAM! If you want to start with sample serverless applications, choose one of the following links:

Tutorial: Deploying a Hello World application – Step-by-step instructions to download, build, and deploy a simple serverless application.

Install, Update, and Uninstall the AWS CLI version 1 on Windows

You can install version 1 of the AWS Command Line Interface (AWS CLI) on Windows by using a standalone installer (recommended) or pip , which is a package manager for Python.

Don’t include the prompt symbol ( C:\> ) when you type a command. These are included in program listings to differentiate commands that you type from output returned by the CLI. The rest of this guide uses the generic prompt symbol ( $ ), except in cases where a command is Windows-specific.

Topics

Install, update, and uninstall the AWS CLI version 1 using the MSI installer

The AWS CLI version 1 is supported on Windows XP or later. For Windows users, the MSI installation package offers a familiar and convenient way to install the AWS CLI version 1 without installing any other prerequisites.

Install and update the AWS CLI version 1 using the MSI installer

Download the appropriate MSI installer:

Run the downloaded MSI installer or the setup file.

Follow the on-screen instructions. By default, the AWS CLI version 1 installs to C:\Program Files\Amazon\AWSCLI (64-bit version) or C:\Program Files (x86)\Amazon\AWSCLI (32-bit version).

To confirm the installation, use the aws —version command at a command prompt (open the Start menu and search for cmd to start a command prompt).

If Windows is unable to find the program, you might need to close and reopen the command prompt to refresh the path, or add the installation directory to your PATH environment variable manually.

Читайте также:  Как найти папку по названию windows 10

Uninstall the AWS CLI version 1

To use the following uninstall instructions, you need to have installed the AWS CLI version 1 with the MSI installer or setup file.

Open Programs and Features by doing one of the following:

Open the Control Panel, and then choose Programs and Features.

Open a command prompt and enter the following command.

Select the entry named AWS Command Line Interface, and then choose Uninstall to launch the uninstaller.

Confirm that you want to uninstall the AWS CLI.

Install, update, and uninstall the AWS CLI version 1 using Python and pip on Windows

The Python Software Foundation provides installers for Windows that include pip .

Prerequisites

You must have Python 2 version 2.7 or later, or Python 3 version 3.6 or later installed. For installation instructions, see the Downloading Python page in Python’s Beginner Guide.

As of 2/1/2021 Python 3.4 and 3.5 is deprecated.

In order to use the AWS CLI version 1 with an older version of Python, you need to install an earlier version of the AWS CLI version 1.

To view the AWS CLI version 1 Python version support matrix, see About the AWS CLI versions.

Install and update the AWS CLI version 1 using pip

To Install the AWS CLI version 1, use the pip3 command (if you use Python version 3 or later) or the pip command.

For the latest version of the AWS CLI, use the following command block:

For a specific version of the AWS CLI, append a less-than symbol and the version number to the filename. For this example the filename for version 1.16.312 would be resulting in the following command:

Verify that the AWS CLI version 1 is installed correctly. If there is no response, see the Add the AWS CLI version 1 executable to your command line path section.

Uninstall the AWS CLI version 1 using pip

If you installed the AWS CLI version 1 using pip , you must also uninstall using pip . If you use Python version 3 or later, we recommend that you use the pip3 command.

You might need to restart your command prompt window or your computer to remove all files.

Add the AWS CLI version 1 executable to your command line path

After installing the AWS CLI version 1 with pip , add the aws program to your operating system’s PATH environment variable. With an MSI installation, this should happen automatically. But if the aws command doesn’t run after you install it, you might need to set it manually.

Use the where command to find the aws file location. By default, the where command shows where a specified program is found in the system’s PATH .

The paths that show up depend on your platform and which method you used to install the AWS CLI. Folder names that include version numbers can vary. These examples reflect the use of Python version 3.7. Replace the version with the version number you’re using, as needed. Typical paths include the following:

Python 3 and pip3 – C:\Program Files\Python37\Scripts\

Python 3 and pip3 —user option on earlier versions of Windows – %USERPROFILE%\AppData\Local\Programs\Python\Python37\Scripts

Python 3 and pip3 —user option on Windows 10 – %USERPROFILE%\AppData\Roaming\Python\Python37\Scripts

MSI installer (64-bit) – C:\Program Files\Amazon\AWSCLI\bin

MSI installer (32-bit) – C:\Program Files (x86)\Amazon\AWSCLI\bin

Use the following steps based on whether a file path is returned.

You can find where the aws program is installed by running the following command.

A file path is NOT returned

If the where command returns the following error, it’s not in the system PATH and you can’t run it by entering its name.

In that case, run the where command with the /R path parameter to tell it to search all folders, and then add the path manually. Use the command line or File Explorer to discover where it’s installed on your computer.

Press the Windows key and enter environment variables .

Choose Edit environment variables for your account.

Choose PATH, and then choose Edit.

Add the path you found into the Variable value field, for example, C:\Program Files\Amazon\AWSCLI\bin\aws.exe .

Choose OK twice to apply the new settings.

Close any running command prompts and reopen the command prompt window.

Оцените статью