New upstream version 1.18.111
Noah Meyerhans
3 years ago
0 | include README.rst | |
0 | include README.md | |
1 | 1 | include LICENSE.txt |
2 | 2 | include requirements.txt |
3 | 3 | recursive-include awscli/examples *.rst *.txt |
0 | 0 | Metadata-Version: 1.1 |
1 | 1 | Name: awscli |
2 | Version: 1.18.99 | |
2 | Version: 1.18.111 | |
3 | 3 | Summary: Universal Command Line Environment for AWS. |
4 | 4 | Home-page: http://aws.amazon.com/cli/ |
5 | 5 | Author: Amazon Web Services |
6 | 6 | Author-email: UNKNOWN |
7 | 7 | License: Apache License 2.0 |
8 | Description: ======= | |
9 | aws-cli | |
10 | ======= | |
11 | ||
12 | .. image:: https://travis-ci.org/aws/aws-cli.svg?branch=develop | |
13 | :target: https://travis-ci.org/aws/aws-cli | |
14 | :alt: Build Status | |
15 | ||
16 | .. image:: https://badges.gitter.im/aws/aws-cli.svg | |
17 | :target: https://gitter.im/aws/aws-cli | |
18 | :alt: Gitter | |
19 | ||
8 | Description: # aws-cli | |
9 | ||
10 | [![Build Status](https://travis-ci.org/aws/aws-cli.svg?branch=develop)](https://travis-ci.org/aws/aws-cli) | |
11 | ||
12 | [![Gitter](https://badges.gitter.im/aws/aws-cli.svg)](https://gitter.im/aws/aws-cli) | |
20 | 13 | |
21 | 14 | This package provides a unified command line interface to Amazon Web Services. |
22 | 15 | |
16 | Jump to: | |
17 | ||
18 | - [Getting Started](#getting-started) | |
19 | - [Getting Help](#getting-help) | |
20 | - [More Resources](#more-resources) | |
21 | ||
22 | ## Getting Started | |
23 | ||
24 | This README is for the AWS CLI version 1. If you are looking for information about the AWS CLI version 2, please visit the [v2 branch](https://github.com/aws/aws-cli/tree/v2). | |
25 | ||
26 | ### Requirements | |
27 | ||
23 | 28 | The aws-cli package works on Python versions: |
24 | 29 | |
25 | * 2.7.x and greater | |
26 | * 3.4.x and greater | |
27 | * 3.5.x and greater | |
28 | * 3.6.x and greater | |
29 | * 3.7.x and greater | |
30 | * 3.8.x and greater | |
31 | ||
32 | On 10/09/2019 support for Python 2.6 and Python 3.3 was deprecated and support | |
33 | was dropped on 01/10/2020. To avoid disruption, customers using the AWS CLI | |
34 | on Python 2.6 or 3.3 will need to upgrade their version of Python or pin the | |
35 | version of the AWS CLI in use prior to 01/10/2020. For more information, see | |
36 | this `blog post <https://aws.amazon.com/blogs/developer/deprecation-of-python-2-6-and-python-3-3-in-botocore-boto3-and-the-aws-cli/>`__. | |
37 | ||
38 | ||
39 | .. attention:: | |
40 | We recommend that all customers regularly monitor the | |
41 | `Amazon Web Services Security Bulletins website`_ for any important security bulletins related to | |
42 | aws-cli. | |
43 | ||
44 | ||
45 | ------------ | |
46 | Installation | |
47 | ------------ | |
48 | ||
49 | The easiest way to install aws-cli is to use `pip`_ in a ``virtualenv``:: | |
30 | - 2.7.x and greater | |
31 | - 3.4.x and greater | |
32 | - 3.5.x and greater | |
33 | - 3.6.x and greater | |
34 | - 3.7.x and greater | |
35 | - 3.8.x and greater | |
36 | ||
37 | On 10/09/2019 support for Python 2.6 and Python 3.3 was deprecated and support was dropped on 01/10/2020. To avoid disruption, customers using the AWS CLI on Python 2.6 or 3.3 will need to upgrade their version of Python or pin the version of the AWS CLI in use prior to 01/10/2020. For more information, see this [blog post](https://aws.amazon.com/blogs/developer/deprecation-of-python-2-6-and-python-3-3-in-botocore-boto3-and-the-aws-cli/). | |
38 | ||
39 | *Attention!* | |
40 | ||
41 | *We recommend that all customers regularly monitor the [Amazon Web Services Security Bulletins website](https://aws.amazon.com/security/security-bulletins) for any important security bulletins related to aws-cli.* | |
42 | ||
43 | ### Installation | |
44 | ||
45 | The safest way to install the AWS CLI is to use [pip](https://pip.pypa.io/en/stable/) in a `virtualenv`: | |
50 | 46 | |
51 | 47 | $ python -m pip install awscli |
52 | 48 | |
53 | or, if you are not installing in a ``virtualenv``, to install globally:: | |
49 | or, if you are not installing in a `virtualenv`, to install globally: | |
54 | 50 | |
55 | 51 | $ sudo python -m pip install awscli |
56 | 52 | |
57 | or for your user:: | |
53 | or for your user: | |
58 | 54 | |
59 | 55 | $ python -m pip install --user awscli |
60 | 56 | |
61 | If you have the aws-cli installed and want to upgrade to the latest version | |
62 | you can run:: | |
57 | If you have the aws-cli package installed and want to upgrade to the latest version you can run: | |
63 | 58 | |
64 | 59 | $ python -m pip install --upgrade awscli |
65 | 60 | |
66 | .. note:: | |
67 | ||
68 | On macOS, if you see an error regarding the version of six that came with | |
69 | distutils in El Capitan, use the ``--ignore-installed`` option:: | |
70 | ||
71 | $ sudo python -m pip install awscli --ignore-installed six | |
72 | ||
73 | ||
74 | This will install the aws-cli package as well as all dependencies. You can | |
75 | also just `download the tarball`_. Once you have the | |
76 | awscli directory structure on your workstation, you can just run:: | |
77 | ||
78 | $ cd <path_to_awscli> | |
79 | $ python setup.py install | |
80 | ||
81 | If you want to run the ``develop`` branch of the CLI, see the | |
82 | "CLI Dev Version" section below. | |
83 | ||
84 | ||
85 | ------------ | |
86 | CLI Releases | |
87 | ------------ | |
88 | ||
89 | The release notes for the AWS CLI can be found `here <https://github.com/aws/aws-cli/blob/develop/CHANGELOG.rst>`__. | |
90 | ||
91 | ||
92 | ------------------ | |
93 | Command Completion | |
94 | ------------------ | |
95 | ||
96 | The aws-cli package includes a very useful command completion feature. | |
97 | This feature is not automatically installed so you need to configure it manually. | |
98 | To enable tab completion for bash either use the built-in command ``complete``:: | |
99 | ||
100 | $ complete -C aws_completer aws | |
101 | ||
102 | Or add ``bin/aws_bash_completer`` file under ``/etc/bash_completion.d``, | |
103 | ``/usr/local/etc/bash_completion.d`` or any other ``bash_completion.d`` location. | |
104 | ||
105 | For tcsh:: | |
106 | ||
107 | $ complete aws 'p/*/`aws_completer`/' | |
108 | ||
109 | You should add this to your startup scripts to enable it for future sessions. | |
110 | ||
111 | For zsh please refer to ``bin/aws_zsh_completer.sh``. Source that file, e.g. | |
112 | from your ``~/.zshrc``, and make sure you run ``compinit`` before:: | |
113 | ||
114 | $ source bin/aws_zsh_completer.sh | |
115 | ||
116 | For now the bash compatibility auto completion (``bashcompinit``) is used. | |
117 | For further details please refer to the top of ``bin/aws_zsh_completer.sh``. | |
118 | ||
119 | --------------- | |
120 | Getting Started | |
121 | --------------- | |
122 | ||
123 | Before using aws-cli, you need to tell it about your AWS credentials. You | |
124 | can do this in several ways: | |
125 | ||
126 | * Environment variables | |
127 | * Shared credentials file | |
128 | * Config file | |
129 | * IAM Role | |
130 | ||
131 | The quickest way to get started is to run the ``aws configure`` command:: | |
61 | This will install the aws-cli package as well as all dependencies. | |
62 | ||
63 | *Note* | |
64 | ||
65 | *On macOS, if you see an error regarding the version of `six` that came with `distutils` in El Capitan, use the `--ignore-installed` option:* | |
66 | ||
67 | $ sudo python -m pip install awscli --ignore-installed six | |
68 | ||
69 | On Linux and Mac OS, the AWS CLI can be installed using a [bundled installer](https://docs.aws.amazon.com/cli/latest/userguide/install-linux.html#install-linux-bundled). The AWS CLI can also be installed on Windows via an [MSI Installer](https://docs.aws.amazon.com/cli/latest/userguide/install-windows.html#msi-on-windows). | |
70 | ||
71 | If you want to run the `develop` branch of the AWS CLI, see the [Development Version](CONTRIBUTING.md#development-version) section of the contributing guide. | |
72 | ||
73 | See the [installation](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv1.html) section of the AWS CLI User Guide for more information. | |
74 | ||
75 | ### Configuration | |
76 | ||
77 | Before using the AWS CLI, you need to configure your AWS credentials. You can do this in several ways: | |
78 | ||
79 | - Configuration command | |
80 | - Environment variables | |
81 | - Shared credentials file | |
82 | - Config file | |
83 | - IAM Role | |
84 | ||
85 | The quickest way to get started is to run the `aws configure` command: | |
132 | 86 | |
133 | 87 | $ aws configure |
134 | AWS Access Key ID: foo | |
135 | AWS Secret Access Key: bar | |
88 | AWS Access Key ID: MYACCESSKEY | |
89 | AWS Secret Access Key: MYSECRETKEY | |
136 | 90 | Default region name [us-west-2]: us-west-2 |
137 | 91 | Default output format [None]: json |
138 | 92 | |
139 | To use environment variables, do the following:: | |
93 | To use environment variables, do the following: | |
140 | 94 | |
141 | 95 | $ export AWS_ACCESS_KEY_ID=<access_key> |
142 | 96 | $ export AWS_SECRET_ACCESS_KEY=<secret_key> |
143 | 97 | |
144 | To use the shared credentials file, create an INI formatted file like this:: | |
98 | To use the shared credentials file, create an INI formatted file like this: | |
145 | 99 | |
146 | 100 | [default] |
147 | aws_access_key_id=foo | |
148 | aws_secret_access_key=bar | |
101 | aws_access_key_id=MYACCESSKEY | |
102 | aws_secret_access_key=MYSECRETKEY | |
149 | 103 | |
150 | 104 | [testing] |
151 | aws_access_key_id=foo | |
152 | aws_secret_access_key=bar | |
153 | ||
154 | and place it in ``~/.aws/credentials`` (or in | |
155 | ``%UserProfile%\.aws/credentials`` on Windows). If you wish to place the | |
156 | shared credentials file in a different location than the one specified above, | |
157 | you need to tell aws-cli where to find it. Do this by setting | |
158 | the appropriate environment variable:: | |
105 | aws_access_key_id=MYACCESKEY | |
106 | aws_secret_access_key=MYSECRETKEY | |
107 | ||
108 | and place it in `~/.aws/credentials` (or in `%UserProfile%\.aws/credentials` on Windows). If you wish to place the shared credentials file in a different location than the one specified above, you need to tell aws-cli where to find it. Do this by setting the appropriate environment variable: | |
159 | 109 | |
160 | 110 | $ export AWS_SHARED_CREDENTIALS_FILE=/path/to/shared_credentials_file |
161 | 111 | |
162 | To use a config file, create a configuration file like this:: | |
112 | To use a config file, create an INI formatted file like this: | |
163 | 113 | |
164 | 114 | [default] |
165 | 115 | aws_access_key_id=<default access key> |
172 | 122 | aws_secret_access_key=<testing secret key> |
173 | 123 | region=us-west-2 |
174 | 124 | |
175 | and place it in ``~/.aws/config`` (or in ``%UserProfile%\.aws\config`` on Windows). If you wish to place the config file in a different location than the one | |
176 | specified above, you need to tell aws-cli where to find it. Do this by setting | |
177 | the appropriate environment variable:: | |
125 | and place it in `~/.aws/config` (or in `%UserProfile%\.aws\config` on Windows). If you wish to place the config file in a different location than the one specified above, you need to tell the AWS CLI where to find it. Do this by setting the appropriate environment variable: | |
178 | 126 | |
179 | 127 | $ export AWS_CONFIG_FILE=/path/to/config_file |
180 | 128 | |
181 | As you can see, you can have multiple ``profiles`` defined in both the shared | |
182 | credentials file and the configuration file. You can then specify which | |
183 | profile to use by using the ``--profile`` option. If no profile is specified | |
184 | the ``default`` profile is used. | |
185 | ||
186 | In the config file, except for the default profile, you | |
187 | **must** prefix each config section of a profile group with ``profile``. | |
188 | For example, if you have a profile named "testing" the section header would | |
189 | be ``[profile testing]``. | |
190 | ||
191 | The final option for credentials is highly recommended if you are | |
192 | using aws-cli on an EC2 instance. IAM Roles are | |
193 | a great way to have credentials installed automatically on your | |
194 | instance. If you are using IAM Roles, aws-cli will find them and use | |
195 | them automatically. | |
196 | ||
197 | ---------------------------- | |
198 | Other Configurable Variables | |
199 | ---------------------------- | |
200 | ||
201 | In addition to credentials, a number of other variables can be | |
202 | configured either with environment variables, configuration file | |
203 | entries or both. The following table documents these. | |
204 | ||
205 | ============================= =========== ============================= ================================= ================================== | |
206 | Variable Option Config Entry Environment Variable Description | |
207 | ============================= =========== ============================= ================================= ================================== | |
208 | profile --profile profile AWS_PROFILE Default profile name | |
209 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
210 | region --region region AWS_DEFAULT_REGION Default AWS Region | |
211 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
212 | config_file AWS_CONFIG_FILE Alternate location of config | |
213 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
214 | credentials_file AWS_SHARED_CREDENTIALS_FILE Alternate location of credentials | |
215 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
216 | output --output output AWS_DEFAULT_OUTPUT Default output style | |
217 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
218 | ca_bundle --ca-bundle ca_bundle AWS_CA_BUNDLE CA Certificate Bundle | |
219 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
220 | access_key aws_access_key_id AWS_ACCESS_KEY_ID AWS Access Key | |
221 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
222 | secret_key aws_secret_access_key AWS_SECRET_ACCESS_KEY AWS Secret Key | |
223 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
224 | token aws_session_token AWS_SESSION_TOKEN AWS Token (temp credentials) | |
225 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
226 | cli_timestamp_format cli_timestamp_format Output format of timestamps | |
227 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
228 | metadata_service_timeout metadata_service_timeout AWS_METADATA_SERVICE_TIMEOUT EC2 metadata timeout | |
229 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
230 | metadata_service_num_attempts metadata_service_num_attempts AWS_METADATA_SERVICE_NUM_ATTEMPTS EC2 metadata retry count | |
231 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
232 | parameter_validation parameter_validation Toggles local parameter validation | |
233 | ============================= =========== ============================= ================================= ================================== | |
234 | ||
235 | ^^^^^^^^ | |
236 | Examples | |
237 | ^^^^^^^^ | |
238 | ||
239 | If you get tired of specifying a ``--region`` option on the command line | |
240 | all of the time, you can specify a default region to use whenever no | |
241 | explicit ``--region`` option is included using the ``region`` variable. | |
242 | To specify this using an environment variable:: | |
243 | ||
244 | $ export AWS_DEFAULT_REGION=us-west-2 | |
245 | ||
246 | To include it in your config file:: | |
247 | ||
248 | [default] | |
249 | aws_access_key_id=<default access key> | |
250 | aws_secret_access_key=<default secret key> | |
251 | region=us-west-1 | |
252 | ||
253 | Similarly, the ``profile`` variable can be used to specify which profile to use | |
254 | if one is not explicitly specified on the command line via the | |
255 | ``--profile`` option. To set this via environment variable:: | |
256 | ||
257 | $ export AWS_PROFILE=testing | |
258 | ||
259 | The ``profile`` variable can not be specified in the configuration file | |
260 | since it would have to be associated with a profile and would defeat the | |
261 | purpose. | |
262 | ||
263 | ^^^^^^^^^^^^^^^^^^^ | |
264 | Further Information | |
265 | ^^^^^^^^^^^^^^^^^^^ | |
266 | ||
267 | For more information about configuration options, please refer the | |
268 | `AWS CLI Configuration Variables topic <http://docs.aws.amazon.com/cli/latest/topic/config-vars.html#cli-aws-help-config-vars>`_. You can access this topic | |
269 | from the CLI as well by running ``aws help config-vars``. | |
270 | ||
271 | ||
272 | ---------------------------------------- | |
273 | Accessing Services With Global Endpoints | |
274 | ---------------------------------------- | |
275 | ||
276 | Some services, such as *AWS Identity and Access Management* (IAM) | |
277 | have a single, global endpoint rather than different endpoints for | |
278 | each region. | |
279 | ||
280 | To make access to these services simpler, aws-cli will automatically | |
281 | use the global endpoint unless you explicitly supply a region (using | |
282 | the ``--region`` option) or a profile (using the ``--profile`` option). | |
283 | Therefore, the following:: | |
284 | ||
285 | $ aws iam list-users | |
286 | ||
287 | will automatically use the global endpoint for the IAM service | |
288 | regardless of the value of the ``AWS_DEFAULT_REGION`` environment | |
289 | variable or the ``region`` variable specified in your profile. | |
290 | ||
291 | -------------------- | |
292 | JSON Parameter Input | |
293 | -------------------- | |
294 | ||
295 | Many options that need to be provided are simple string or numeric | |
296 | values. However, some operations require JSON data structures | |
297 | as input parameters either on the command line or in files. | |
298 | ||
299 | For example, consider the command to authorize access to an EC2 | |
300 | security group. In this case, we will add ingress access to port 22 | |
301 | for all IP addresses:: | |
302 | ||
303 | $ aws ec2 authorize-security-group-ingress --group-name MySecurityGroup \ | |
304 | --ip-permissions '{"FromPort":22,"ToPort":22,"IpProtocol":"tcp","IpRanges":[{"CidrIp": "0.0.0.0/0"}]}' | |
305 | ||
306 | -------------------------- | |
307 | File-based Parameter Input | |
308 | -------------------------- | |
309 | ||
310 | Some parameter values are so large or so complex that it would be easier | |
311 | to place the parameter value in a file and refer to that file rather than | |
312 | entering the value directly on the command line. | |
313 | ||
314 | Let's use the ``authorize-security-group-ingress`` command shown above. | |
315 | Rather than provide the value of the ``--ip-permissions`` parameter directly | |
316 | in the command, you could first store the values in a file. Let's call | |
317 | the file ``ip_perms.json``:: | |
318 | ||
319 | {"FromPort":22, | |
320 | "ToPort":22, | |
321 | "IpProtocol":"tcp", | |
322 | "IpRanges":[{"CidrIp":"0.0.0.0/0"}]} | |
323 | ||
324 | Then, we could make the same call as above like this:: | |
325 | ||
326 | $ aws ec2 authorize-security-group-ingress --group-name MySecurityGroup \ | |
327 | --ip-permissions file://ip_perms.json | |
328 | ||
329 | The ``file://`` prefix on the parameter value signals that the parameter value | |
330 | is actually a reference to a file that contains the actual parameter value. | |
331 | aws-cli will open the file, read the value and use that value as the | |
332 | parameter value. | |
333 | ||
334 | This is also useful when the parameter is really referring to file-based | |
335 | data. For example, the ``--user-data`` option of the ``aws ec2 run-instances`` | |
336 | command or the ``--public-key-material`` parameter of the | |
337 | ``aws ec2 import-key-pair`` command. | |
338 | ||
339 | ------------------------- | |
340 | URI-based Parameter Input | |
341 | ------------------------- | |
342 | ||
343 | Similar to the file-based input described above, aws-cli also includes a | |
344 | way to use data from a URI as the value of a parameter. The idea is exactly | |
345 | the same except the prefix used is ``https://`` or ``http://``:: | |
346 | ||
347 | $ aws ec2 authorize-security-group-ingress --group-name MySecurityGroup \ | |
348 | --ip-permissions http://mybucket.s3.amazonaws.com/ip_perms.json | |
349 | ||
350 | -------------- | |
351 | Command Output | |
352 | -------------- | |
353 | ||
354 | The default output for commands is currently JSON. You can use the | |
355 | ``--query`` option to extract the output elements from this JSON document. | |
356 | For more information on the expression language used for the ``--query`` | |
357 | argument, you can read the | |
358 | `JMESPath Tutorial <http://jmespath.org/tutorial.html>`__. | |
359 | ||
360 | ^^^^^^^^ | |
361 | Examples | |
362 | ^^^^^^^^ | |
363 | ||
364 | Get a list of IAM user names:: | |
365 | ||
366 | $ aws iam list-users --query Users[].UserName | |
367 | ||
368 | Get a list of key names and their sizes in an S3 bucket:: | |
369 | ||
370 | $ aws s3api list-objects --bucket b --query Contents[].[Key,Size] | |
371 | ||
372 | Get a list of all EC2 instances and include their Instance ID, State Name, | |
373 | and their Name (if they've been tagged with a Name):: | |
374 | ||
375 | $ aws ec2 describe-instances --query \ | |
376 | 'Reservations[].Instances[].[InstanceId,State.Name,Tags[?Key==`Name`] | [0].Value]' | |
377 | ||
378 | ||
379 | You may also find the `jq <http://stedolan.github.com/jq/>`_ tool useful in | |
380 | processing the JSON output for other uses. | |
381 | ||
382 | There is also an ASCII table format available. You can select this style with | |
383 | the ``--output table`` option or you can make this style your default output | |
384 | style via environment variable or config file entry as described above. | |
385 | Try adding ``--output table`` to the above commands. | |
386 | ||
387 | ||
388 | --------------- | |
389 | CLI Dev Version | |
390 | --------------- | |
391 | ||
392 | If you are just interested in using the latest released version of the AWS CLI, | |
393 | please see the Installation_ section above. This section is for anyone who | |
394 | wants to install the development version of the CLI. You normally would not | |
395 | need to do this unless: | |
396 | ||
397 | * You are developing a feature for the CLI and plan on submitting a Pull | |
398 | Request. | |
399 | * You want to test the latest changes of the CLI before they make it into an | |
400 | official release. | |
401 | ||
402 | The latest changes to the CLI are in the ``develop`` branch on github. This is | |
403 | the default branch when you clone the git repository. | |
404 | ||
405 | Additionally, there are several other packages that are developed in lockstep | |
406 | with the CLI. This includes: | |
407 | ||
408 | * `botocore <https://github.com/boto/botocore>`__ | |
409 | * `jmespath <https://github.com/boto/jmespath>`__ | |
410 | ||
411 | If you just want to install a snapshot of the latest development version of | |
412 | the CLI, you can use the ``requirements.txt`` file included in this repo. | |
413 | This file points to the development version of the above packages:: | |
414 | ||
415 | $ cd <path_to_awscli> | |
416 | $ python -m pip install -r requirements.txt | |
417 | $ python -m pip install -e . | |
418 | ||
419 | However, to keep up to date, you will continually have to run the | |
420 | ``python -m pip install -r requirements.txt`` file to pull in the latest changes | |
421 | from the develop branches of botocore, jmespath, etc. | |
422 | ||
423 | You can optionally clone each of those repositories and run "python -m pip install -e ." | |
424 | for each repository:: | |
425 | ||
426 | $ git clone <jmespath> && cd jmespath/ | |
427 | $ python -m pip install -e . && cd .. | |
428 | $ git clone <botocore> && cd botocore/ | |
429 | $ python -m pip install -e . && cd .. | |
430 | $ git clone <awscli> && cd aws-cli/ | |
431 | $ python -m pip install -e . | |
432 | ||
433 | ||
434 | ------------ | |
435 | Getting Help | |
436 | ------------ | |
437 | ||
438 | We use GitHub issues for tracking bugs and feature requests and have limited | |
439 | bandwidth to address them. Please use these community resources for getting | |
440 | help: | |
441 | ||
442 | * Ask a question on `Stack Overflow <https://stackoverflow.com/>`__ and tag it with `aws-cli <https://stackoverflow.com/questions/tagged/aws-cli>`__ | |
443 | * Come join the AWS CLI community chat on `gitter <https://gitter.im/aws/aws-cli>`__ | |
444 | * Open a support ticket with `AWS Support <https://console.aws.amazon.com/support/home#/>`__ | |
445 | * If it turns out that you may have found a bug, please `open an issue <https://github.com/aws/aws-cli/issues/new>`__ | |
446 | ||
447 | ||
448 | ||
449 | .. _`Amazon Web Services Security Bulletins website`: https://aws.amazon.com/security/security-bulletins | |
450 | .. _pip: https://pip.pypa.io/en/stable/ | |
451 | .. _`download the tarball`: https://pypi.org/project/awscli/ | |
129 | As you can see, you can have multiple `profiles` defined in both the shared credentials file and the configuration file. You can then specify which profile to use by using the `--profile` option. If no profile is specified the `default` profile is used. | |
130 | ||
131 | In the config file, except for the default profile, you **must** prefix each config section of a profile group with `profile`. For example, if you have a profile named \"testing\" the section header would be `[profile testing]`. | |
132 | ||
133 | The final option for credentials is highly recommended if you are using the AWS CLI on an EC2 instance. [IAM Roles](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html) are a great way to have credentials installed automatically on your instance. If you are using IAM Roles, the AWS CLI will find and use them automatically. | |
134 | ||
135 | In addition to credentials, a number of other variables can be configured either with environment variables, configuration file entries, or both. See the [AWS Tools and SDKs Shared Configuration and Credentials Reference Guide](https://docs.aws.amazon.com/credref/latest/refdocs/overview.html) for more information. | |
136 | ||
137 | For more information about configuration options, please refer to the [AWS | |
138 | CLI Configuration Variables topic](http://docs.aws.amazon.com/cli/latest/topic/config-vars.html#cli-aws-help-config-vars). You can access this topic from the AWS CLI as well by running `aws help config-vars`. | |
139 | ||
140 | ### Basic Commands | |
141 | ||
142 | An AWS CLI command has the following structure: | |
143 | ||
144 | $ aws <command> <subcommand> [options and parameters] | |
145 | ||
146 | For example, to list S3 buckets, the command would be: | |
147 | ||
148 | $ aws s3 ls | |
149 | ||
150 | To view help documentation, use one of the following: | |
151 | ||
152 | $ aws help | |
153 | $ aws <command> help | |
154 | $ aws <command> <subcommand> help | |
155 | ||
156 | To get the version of the AWS CLI: | |
157 | ||
158 | $ aws --version | |
159 | ||
160 | To turn on debugging output: | |
161 | ||
162 | $ aws --debug <command> <subcommand> | |
163 | ||
164 | You can read more information on the [Using the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-using.html) chapter of the AWS CLI User Guide. | |
165 | ||
166 | ### Command Completion | |
167 | ||
168 | The aws-cli package includes a command completion feature for Unix-like systems. This feature is not automatically installed so you need to configure it manually. To learn more, read the [AWS CLI Command completion topic](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-completion.html). | |
169 | ||
170 | ## Getting Help | |
171 | ||
172 | The best way to interact with our team is through GitHub. You can [open an issue](https://github.com/aws/aws-cli/issues/new/choose) and choose from one of our templates for guidance, bug reports, or feature requests. | |
173 | ||
174 | You may find help from the community on [Stack Overflow](https://stackoverflow.com/) with the tag [aws-cli](https://stackoverflow.com/questions/tagged/aws-cli) or on the [AWS Discussion Forum for CLI](https://forums.aws.amazon.com/forum.jspa?forumID=150). If you have a support plan with [AWS Premium Support](https://aws.amazon.com/premiumsupport), you can also create a new support case. | |
175 | ||
176 | Please check for open similar [issues](https://github.com/aws/aws-cli/issues/) before opening another one. | |
177 | ||
178 | The AWS CLI implements AWS service APIs. For general issues regarding the services or their limitations, you may find the [Amazon Web Services Discussion Forums](https://forums.aws.amazon.com/) helpful. | |
179 | ||
180 | ## More Resources | |
181 | ||
182 | - [Changelog](https://github.com/aws/aws-cli/blob/develop/CHANGELOG.rst) | |
183 | - [AWS CLI Documentation](https://docs.aws.amazon.com/cli/index.html) | |
184 | - [AWS CLI User Guide](https://docs.aws.amazon.com/cli/latest/userguide/) | |
185 | - [AWS CLI Command Reference](https://docs.aws.amazon.com/cli/latest/reference/) | |
186 | - [Amazon Web Services Discussion Forums](https://forums.aws.amazon.com/) | |
187 | - [AWS Support](https://console.aws.amazon.com/support/home#/) | |
452 | 188 | |
453 | 189 | Platform: UNKNOWN |
454 | 190 | Classifier: Development Status :: 5 - Production/Stable |
0 | # aws-cli | |
1 | ||
2 | [![Build Status](https://travis-ci.org/aws/aws-cli.svg?branch=develop)](https://travis-ci.org/aws/aws-cli) | |
3 | ||
4 | [![Gitter](https://badges.gitter.im/aws/aws-cli.svg)](https://gitter.im/aws/aws-cli) | |
5 | ||
6 | This package provides a unified command line interface to Amazon Web Services. | |
7 | ||
8 | Jump to: | |
9 | ||
10 | - [Getting Started](#getting-started) | |
11 | - [Getting Help](#getting-help) | |
12 | - [More Resources](#more-resources) | |
13 | ||
14 | ## Getting Started | |
15 | ||
16 | This README is for the AWS CLI version 1. If you are looking for information about the AWS CLI version 2, please visit the [v2 branch](https://github.com/aws/aws-cli/tree/v2). | |
17 | ||
18 | ### Requirements | |
19 | ||
20 | The aws-cli package works on Python versions: | |
21 | ||
22 | - 2.7.x and greater | |
23 | - 3.4.x and greater | |
24 | - 3.5.x and greater | |
25 | - 3.6.x and greater | |
26 | - 3.7.x and greater | |
27 | - 3.8.x and greater | |
28 | ||
29 | On 10/09/2019 support for Python 2.6 and Python 3.3 was deprecated and support was dropped on 01/10/2020. To avoid disruption, customers using the AWS CLI on Python 2.6 or 3.3 will need to upgrade their version of Python or pin the version of the AWS CLI in use prior to 01/10/2020. For more information, see this [blog post](https://aws.amazon.com/blogs/developer/deprecation-of-python-2-6-and-python-3-3-in-botocore-boto3-and-the-aws-cli/). | |
30 | ||
31 | *Attention!* | |
32 | ||
33 | *We recommend that all customers regularly monitor the [Amazon Web Services Security Bulletins website](https://aws.amazon.com/security/security-bulletins) for any important security bulletins related to aws-cli.* | |
34 | ||
35 | ### Installation | |
36 | ||
37 | The safest way to install the AWS CLI is to use [pip](https://pip.pypa.io/en/stable/) in a `virtualenv`: | |
38 | ||
39 | $ python -m pip install awscli | |
40 | ||
41 | or, if you are not installing in a `virtualenv`, to install globally: | |
42 | ||
43 | $ sudo python -m pip install awscli | |
44 | ||
45 | or for your user: | |
46 | ||
47 | $ python -m pip install --user awscli | |
48 | ||
49 | If you have the aws-cli package installed and want to upgrade to the latest version you can run: | |
50 | ||
51 | $ python -m pip install --upgrade awscli | |
52 | ||
53 | This will install the aws-cli package as well as all dependencies. | |
54 | ||
55 | *Note* | |
56 | ||
57 | *On macOS, if you see an error regarding the version of `six` that came with `distutils` in El Capitan, use the `--ignore-installed` option:* | |
58 | ||
59 | $ sudo python -m pip install awscli --ignore-installed six | |
60 | ||
61 | On Linux and Mac OS, the AWS CLI can be installed using a [bundled installer](https://docs.aws.amazon.com/cli/latest/userguide/install-linux.html#install-linux-bundled). The AWS CLI can also be installed on Windows via an [MSI Installer](https://docs.aws.amazon.com/cli/latest/userguide/install-windows.html#msi-on-windows). | |
62 | ||
63 | If you want to run the `develop` branch of the AWS CLI, see the [Development Version](CONTRIBUTING.md#development-version) section of the contributing guide. | |
64 | ||
65 | See the [installation](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv1.html) section of the AWS CLI User Guide for more information. | |
66 | ||
67 | ### Configuration | |
68 | ||
69 | Before using the AWS CLI, you need to configure your AWS credentials. You can do this in several ways: | |
70 | ||
71 | - Configuration command | |
72 | - Environment variables | |
73 | - Shared credentials file | |
74 | - Config file | |
75 | - IAM Role | |
76 | ||
77 | The quickest way to get started is to run the `aws configure` command: | |
78 | ||
79 | $ aws configure | |
80 | AWS Access Key ID: MYACCESSKEY | |
81 | AWS Secret Access Key: MYSECRETKEY | |
82 | Default region name [us-west-2]: us-west-2 | |
83 | Default output format [None]: json | |
84 | ||
85 | To use environment variables, do the following: | |
86 | ||
87 | $ export AWS_ACCESS_KEY_ID=<access_key> | |
88 | $ export AWS_SECRET_ACCESS_KEY=<secret_key> | |
89 | ||
90 | To use the shared credentials file, create an INI formatted file like this: | |
91 | ||
92 | [default] | |
93 | aws_access_key_id=MYACCESSKEY | |
94 | aws_secret_access_key=MYSECRETKEY | |
95 | ||
96 | [testing] | |
97 | aws_access_key_id=MYACCESKEY | |
98 | aws_secret_access_key=MYSECRETKEY | |
99 | ||
100 | and place it in `~/.aws/credentials` (or in `%UserProfile%\.aws/credentials` on Windows). If you wish to place the shared credentials file in a different location than the one specified above, you need to tell aws-cli where to find it. Do this by setting the appropriate environment variable: | |
101 | ||
102 | $ export AWS_SHARED_CREDENTIALS_FILE=/path/to/shared_credentials_file | |
103 | ||
104 | To use a config file, create an INI formatted file like this: | |
105 | ||
106 | [default] | |
107 | aws_access_key_id=<default access key> | |
108 | aws_secret_access_key=<default secret key> | |
109 | # Optional, to define default region for this profile. | |
110 | region=us-west-1 | |
111 | ||
112 | [profile testing] | |
113 | aws_access_key_id=<testing access key> | |
114 | aws_secret_access_key=<testing secret key> | |
115 | region=us-west-2 | |
116 | ||
117 | and place it in `~/.aws/config` (or in `%UserProfile%\.aws\config` on Windows). If you wish to place the config file in a different location than the one specified above, you need to tell the AWS CLI where to find it. Do this by setting the appropriate environment variable: | |
118 | ||
119 | $ export AWS_CONFIG_FILE=/path/to/config_file | |
120 | ||
121 | As you can see, you can have multiple `profiles` defined in both the shared credentials file and the configuration file. You can then specify which profile to use by using the `--profile` option. If no profile is specified the `default` profile is used. | |
122 | ||
123 | In the config file, except for the default profile, you **must** prefix each config section of a profile group with `profile`. For example, if you have a profile named \"testing\" the section header would be `[profile testing]`. | |
124 | ||
125 | The final option for credentials is highly recommended if you are using the AWS CLI on an EC2 instance. [IAM Roles](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html) are a great way to have credentials installed automatically on your instance. If you are using IAM Roles, the AWS CLI will find and use them automatically. | |
126 | ||
127 | In addition to credentials, a number of other variables can be configured either with environment variables, configuration file entries, or both. See the [AWS Tools and SDKs Shared Configuration and Credentials Reference Guide](https://docs.aws.amazon.com/credref/latest/refdocs/overview.html) for more information. | |
128 | ||
129 | For more information about configuration options, please refer to the [AWS | |
130 | CLI Configuration Variables topic](http://docs.aws.amazon.com/cli/latest/topic/config-vars.html#cli-aws-help-config-vars). You can access this topic from the AWS CLI as well by running `aws help config-vars`. | |
131 | ||
132 | ### Basic Commands | |
133 | ||
134 | An AWS CLI command has the following structure: | |
135 | ||
136 | $ aws <command> <subcommand> [options and parameters] | |
137 | ||
138 | For example, to list S3 buckets, the command would be: | |
139 | ||
140 | $ aws s3 ls | |
141 | ||
142 | To view help documentation, use one of the following: | |
143 | ||
144 | $ aws help | |
145 | $ aws <command> help | |
146 | $ aws <command> <subcommand> help | |
147 | ||
148 | To get the version of the AWS CLI: | |
149 | ||
150 | $ aws --version | |
151 | ||
152 | To turn on debugging output: | |
153 | ||
154 | $ aws --debug <command> <subcommand> | |
155 | ||
156 | You can read more information on the [Using the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-using.html) chapter of the AWS CLI User Guide. | |
157 | ||
158 | ### Command Completion | |
159 | ||
160 | The aws-cli package includes a command completion feature for Unix-like systems. This feature is not automatically installed so you need to configure it manually. To learn more, read the [AWS CLI Command completion topic](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-completion.html). | |
161 | ||
162 | ## Getting Help | |
163 | ||
164 | The best way to interact with our team is through GitHub. You can [open an issue](https://github.com/aws/aws-cli/issues/new/choose) and choose from one of our templates for guidance, bug reports, or feature requests. | |
165 | ||
166 | You may find help from the community on [Stack Overflow](https://stackoverflow.com/) with the tag [aws-cli](https://stackoverflow.com/questions/tagged/aws-cli) or on the [AWS Discussion Forum for CLI](https://forums.aws.amazon.com/forum.jspa?forumID=150). If you have a support plan with [AWS Premium Support](https://aws.amazon.com/premiumsupport), you can also create a new support case. | |
167 | ||
168 | Please check for open similar [issues](https://github.com/aws/aws-cli/issues/) before opening another one. | |
169 | ||
170 | The AWS CLI implements AWS service APIs. For general issues regarding the services or their limitations, you may find the [Amazon Web Services Discussion Forums](https://forums.aws.amazon.com/) helpful. | |
171 | ||
172 | ## More Resources | |
173 | ||
174 | - [Changelog](https://github.com/aws/aws-cli/blob/develop/CHANGELOG.rst) | |
175 | - [AWS CLI Documentation](https://docs.aws.amazon.com/cli/index.html) | |
176 | - [AWS CLI User Guide](https://docs.aws.amazon.com/cli/latest/userguide/) | |
177 | - [AWS CLI Command Reference](https://docs.aws.amazon.com/cli/latest/reference/) | |
178 | - [Amazon Web Services Discussion Forums](https://forums.aws.amazon.com/) | |
179 | - [AWS Support](https://console.aws.amazon.com/support/home#/) |
0 | ======= | |
1 | aws-cli | |
2 | ======= | |
3 | ||
4 | .. image:: https://travis-ci.org/aws/aws-cli.svg?branch=develop | |
5 | :target: https://travis-ci.org/aws/aws-cli | |
6 | :alt: Build Status | |
7 | ||
8 | .. image:: https://badges.gitter.im/aws/aws-cli.svg | |
9 | :target: https://gitter.im/aws/aws-cli | |
10 | :alt: Gitter | |
11 | ||
12 | ||
13 | This package provides a unified command line interface to Amazon Web Services. | |
14 | ||
15 | The aws-cli package works on Python versions: | |
16 | ||
17 | * 2.7.x and greater | |
18 | * 3.4.x and greater | |
19 | * 3.5.x and greater | |
20 | * 3.6.x and greater | |
21 | * 3.7.x and greater | |
22 | * 3.8.x and greater | |
23 | ||
24 | On 10/09/2019 support for Python 2.6 and Python 3.3 was deprecated and support | |
25 | was dropped on 01/10/2020. To avoid disruption, customers using the AWS CLI | |
26 | on Python 2.6 or 3.3 will need to upgrade their version of Python or pin the | |
27 | version of the AWS CLI in use prior to 01/10/2020. For more information, see | |
28 | this `blog post <https://aws.amazon.com/blogs/developer/deprecation-of-python-2-6-and-python-3-3-in-botocore-boto3-and-the-aws-cli/>`__. | |
29 | ||
30 | ||
31 | .. attention:: | |
32 | We recommend that all customers regularly monitor the | |
33 | `Amazon Web Services Security Bulletins website`_ for any important security bulletins related to | |
34 | aws-cli. | |
35 | ||
36 | ||
37 | ------------ | |
38 | Installation | |
39 | ------------ | |
40 | ||
41 | The easiest way to install aws-cli is to use `pip`_ in a ``virtualenv``:: | |
42 | ||
43 | $ python -m pip install awscli | |
44 | ||
45 | or, if you are not installing in a ``virtualenv``, to install globally:: | |
46 | ||
47 | $ sudo python -m pip install awscli | |
48 | ||
49 | or for your user:: | |
50 | ||
51 | $ python -m pip install --user awscli | |
52 | ||
53 | If you have the aws-cli installed and want to upgrade to the latest version | |
54 | you can run:: | |
55 | ||
56 | $ python -m pip install --upgrade awscli | |
57 | ||
58 | .. note:: | |
59 | ||
60 | On macOS, if you see an error regarding the version of six that came with | |
61 | distutils in El Capitan, use the ``--ignore-installed`` option:: | |
62 | ||
63 | $ sudo python -m pip install awscli --ignore-installed six | |
64 | ||
65 | ||
66 | This will install the aws-cli package as well as all dependencies. You can | |
67 | also just `download the tarball`_. Once you have the | |
68 | awscli directory structure on your workstation, you can just run:: | |
69 | ||
70 | $ cd <path_to_awscli> | |
71 | $ python setup.py install | |
72 | ||
73 | If you want to run the ``develop`` branch of the CLI, see the | |
74 | "CLI Dev Version" section below. | |
75 | ||
76 | ||
77 | ------------ | |
78 | CLI Releases | |
79 | ------------ | |
80 | ||
81 | The release notes for the AWS CLI can be found `here <https://github.com/aws/aws-cli/blob/develop/CHANGELOG.rst>`__. | |
82 | ||
83 | ||
84 | ------------------ | |
85 | Command Completion | |
86 | ------------------ | |
87 | ||
88 | The aws-cli package includes a very useful command completion feature. | |
89 | This feature is not automatically installed so you need to configure it manually. | |
90 | To enable tab completion for bash either use the built-in command ``complete``:: | |
91 | ||
92 | $ complete -C aws_completer aws | |
93 | ||
94 | Or add ``bin/aws_bash_completer`` file under ``/etc/bash_completion.d``, | |
95 | ``/usr/local/etc/bash_completion.d`` or any other ``bash_completion.d`` location. | |
96 | ||
97 | For tcsh:: | |
98 | ||
99 | $ complete aws 'p/*/`aws_completer`/' | |
100 | ||
101 | You should add this to your startup scripts to enable it for future sessions. | |
102 | ||
103 | For zsh please refer to ``bin/aws_zsh_completer.sh``. Source that file, e.g. | |
104 | from your ``~/.zshrc``, and make sure you run ``compinit`` before:: | |
105 | ||
106 | $ source bin/aws_zsh_completer.sh | |
107 | ||
108 | For now the bash compatibility auto completion (``bashcompinit``) is used. | |
109 | For further details please refer to the top of ``bin/aws_zsh_completer.sh``. | |
110 | ||
111 | --------------- | |
112 | Getting Started | |
113 | --------------- | |
114 | ||
115 | Before using aws-cli, you need to tell it about your AWS credentials. You | |
116 | can do this in several ways: | |
117 | ||
118 | * Environment variables | |
119 | * Shared credentials file | |
120 | * Config file | |
121 | * IAM Role | |
122 | ||
123 | The quickest way to get started is to run the ``aws configure`` command:: | |
124 | ||
125 | $ aws configure | |
126 | AWS Access Key ID: foo | |
127 | AWS Secret Access Key: bar | |
128 | Default region name [us-west-2]: us-west-2 | |
129 | Default output format [None]: json | |
130 | ||
131 | To use environment variables, do the following:: | |
132 | ||
133 | $ export AWS_ACCESS_KEY_ID=<access_key> | |
134 | $ export AWS_SECRET_ACCESS_KEY=<secret_key> | |
135 | ||
136 | To use the shared credentials file, create an INI formatted file like this:: | |
137 | ||
138 | [default] | |
139 | aws_access_key_id=foo | |
140 | aws_secret_access_key=bar | |
141 | ||
142 | [testing] | |
143 | aws_access_key_id=foo | |
144 | aws_secret_access_key=bar | |
145 | ||
146 | and place it in ``~/.aws/credentials`` (or in | |
147 | ``%UserProfile%\.aws/credentials`` on Windows). If you wish to place the | |
148 | shared credentials file in a different location than the one specified above, | |
149 | you need to tell aws-cli where to find it. Do this by setting | |
150 | the appropriate environment variable:: | |
151 | ||
152 | $ export AWS_SHARED_CREDENTIALS_FILE=/path/to/shared_credentials_file | |
153 | ||
154 | To use a config file, create a configuration file like this:: | |
155 | ||
156 | [default] | |
157 | aws_access_key_id=<default access key> | |
158 | aws_secret_access_key=<default secret key> | |
159 | # Optional, to define default region for this profile. | |
160 | region=us-west-1 | |
161 | ||
162 | [profile testing] | |
163 | aws_access_key_id=<testing access key> | |
164 | aws_secret_access_key=<testing secret key> | |
165 | region=us-west-2 | |
166 | ||
167 | and place it in ``~/.aws/config`` (or in ``%UserProfile%\.aws\config`` on Windows). If you wish to place the config file in a different location than the one | |
168 | specified above, you need to tell aws-cli where to find it. Do this by setting | |
169 | the appropriate environment variable:: | |
170 | ||
171 | $ export AWS_CONFIG_FILE=/path/to/config_file | |
172 | ||
173 | As you can see, you can have multiple ``profiles`` defined in both the shared | |
174 | credentials file and the configuration file. You can then specify which | |
175 | profile to use by using the ``--profile`` option. If no profile is specified | |
176 | the ``default`` profile is used. | |
177 | ||
178 | In the config file, except for the default profile, you | |
179 | **must** prefix each config section of a profile group with ``profile``. | |
180 | For example, if you have a profile named "testing" the section header would | |
181 | be ``[profile testing]``. | |
182 | ||
183 | The final option for credentials is highly recommended if you are | |
184 | using aws-cli on an EC2 instance. IAM Roles are | |
185 | a great way to have credentials installed automatically on your | |
186 | instance. If you are using IAM Roles, aws-cli will find them and use | |
187 | them automatically. | |
188 | ||
189 | ---------------------------- | |
190 | Other Configurable Variables | |
191 | ---------------------------- | |
192 | ||
193 | In addition to credentials, a number of other variables can be | |
194 | configured either with environment variables, configuration file | |
195 | entries or both. The following table documents these. | |
196 | ||
197 | ============================= =========== ============================= ================================= ================================== | |
198 | Variable Option Config Entry Environment Variable Description | |
199 | ============================= =========== ============================= ================================= ================================== | |
200 | profile --profile profile AWS_PROFILE Default profile name | |
201 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
202 | region --region region AWS_DEFAULT_REGION Default AWS Region | |
203 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
204 | config_file AWS_CONFIG_FILE Alternate location of config | |
205 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
206 | credentials_file AWS_SHARED_CREDENTIALS_FILE Alternate location of credentials | |
207 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
208 | output --output output AWS_DEFAULT_OUTPUT Default output style | |
209 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
210 | ca_bundle --ca-bundle ca_bundle AWS_CA_BUNDLE CA Certificate Bundle | |
211 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
212 | access_key aws_access_key_id AWS_ACCESS_KEY_ID AWS Access Key | |
213 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
214 | secret_key aws_secret_access_key AWS_SECRET_ACCESS_KEY AWS Secret Key | |
215 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
216 | token aws_session_token AWS_SESSION_TOKEN AWS Token (temp credentials) | |
217 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
218 | cli_timestamp_format cli_timestamp_format Output format of timestamps | |
219 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
220 | metadata_service_timeout metadata_service_timeout AWS_METADATA_SERVICE_TIMEOUT EC2 metadata timeout | |
221 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
222 | metadata_service_num_attempts metadata_service_num_attempts AWS_METADATA_SERVICE_NUM_ATTEMPTS EC2 metadata retry count | |
223 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
224 | parameter_validation parameter_validation Toggles local parameter validation | |
225 | ============================= =========== ============================= ================================= ================================== | |
226 | ||
227 | ^^^^^^^^ | |
228 | Examples | |
229 | ^^^^^^^^ | |
230 | ||
231 | If you get tired of specifying a ``--region`` option on the command line | |
232 | all of the time, you can specify a default region to use whenever no | |
233 | explicit ``--region`` option is included using the ``region`` variable. | |
234 | To specify this using an environment variable:: | |
235 | ||
236 | $ export AWS_DEFAULT_REGION=us-west-2 | |
237 | ||
238 | To include it in your config file:: | |
239 | ||
240 | [default] | |
241 | aws_access_key_id=<default access key> | |
242 | aws_secret_access_key=<default secret key> | |
243 | region=us-west-1 | |
244 | ||
245 | Similarly, the ``profile`` variable can be used to specify which profile to use | |
246 | if one is not explicitly specified on the command line via the | |
247 | ``--profile`` option. To set this via environment variable:: | |
248 | ||
249 | $ export AWS_PROFILE=testing | |
250 | ||
251 | The ``profile`` variable can not be specified in the configuration file | |
252 | since it would have to be associated with a profile and would defeat the | |
253 | purpose. | |
254 | ||
255 | ^^^^^^^^^^^^^^^^^^^ | |
256 | Further Information | |
257 | ^^^^^^^^^^^^^^^^^^^ | |
258 | ||
259 | For more information about configuration options, please refer the | |
260 | `AWS CLI Configuration Variables topic <http://docs.aws.amazon.com/cli/latest/topic/config-vars.html#cli-aws-help-config-vars>`_. You can access this topic | |
261 | from the CLI as well by running ``aws help config-vars``. | |
262 | ||
263 | ||
264 | ---------------------------------------- | |
265 | Accessing Services With Global Endpoints | |
266 | ---------------------------------------- | |
267 | ||
268 | Some services, such as *AWS Identity and Access Management* (IAM) | |
269 | have a single, global endpoint rather than different endpoints for | |
270 | each region. | |
271 | ||
272 | To make access to these services simpler, aws-cli will automatically | |
273 | use the global endpoint unless you explicitly supply a region (using | |
274 | the ``--region`` option) or a profile (using the ``--profile`` option). | |
275 | Therefore, the following:: | |
276 | ||
277 | $ aws iam list-users | |
278 | ||
279 | will automatically use the global endpoint for the IAM service | |
280 | regardless of the value of the ``AWS_DEFAULT_REGION`` environment | |
281 | variable or the ``region`` variable specified in your profile. | |
282 | ||
283 | -------------------- | |
284 | JSON Parameter Input | |
285 | -------------------- | |
286 | ||
287 | Many options that need to be provided are simple string or numeric | |
288 | values. However, some operations require JSON data structures | |
289 | as input parameters either on the command line or in files. | |
290 | ||
291 | For example, consider the command to authorize access to an EC2 | |
292 | security group. In this case, we will add ingress access to port 22 | |
293 | for all IP addresses:: | |
294 | ||
295 | $ aws ec2 authorize-security-group-ingress --group-name MySecurityGroup \ | |
296 | --ip-permissions '{"FromPort":22,"ToPort":22,"IpProtocol":"tcp","IpRanges":[{"CidrIp": "0.0.0.0/0"}]}' | |
297 | ||
298 | -------------------------- | |
299 | File-based Parameter Input | |
300 | -------------------------- | |
301 | ||
302 | Some parameter values are so large or so complex that it would be easier | |
303 | to place the parameter value in a file and refer to that file rather than | |
304 | entering the value directly on the command line. | |
305 | ||
306 | Let's use the ``authorize-security-group-ingress`` command shown above. | |
307 | Rather than provide the value of the ``--ip-permissions`` parameter directly | |
308 | in the command, you could first store the values in a file. Let's call | |
309 | the file ``ip_perms.json``:: | |
310 | ||
311 | {"FromPort":22, | |
312 | "ToPort":22, | |
313 | "IpProtocol":"tcp", | |
314 | "IpRanges":[{"CidrIp":"0.0.0.0/0"}]} | |
315 | ||
316 | Then, we could make the same call as above like this:: | |
317 | ||
318 | $ aws ec2 authorize-security-group-ingress --group-name MySecurityGroup \ | |
319 | --ip-permissions file://ip_perms.json | |
320 | ||
321 | The ``file://`` prefix on the parameter value signals that the parameter value | |
322 | is actually a reference to a file that contains the actual parameter value. | |
323 | aws-cli will open the file, read the value and use that value as the | |
324 | parameter value. | |
325 | ||
326 | This is also useful when the parameter is really referring to file-based | |
327 | data. For example, the ``--user-data`` option of the ``aws ec2 run-instances`` | |
328 | command or the ``--public-key-material`` parameter of the | |
329 | ``aws ec2 import-key-pair`` command. | |
330 | ||
331 | ------------------------- | |
332 | URI-based Parameter Input | |
333 | ------------------------- | |
334 | ||
335 | Similar to the file-based input described above, aws-cli also includes a | |
336 | way to use data from a URI as the value of a parameter. The idea is exactly | |
337 | the same except the prefix used is ``https://`` or ``http://``:: | |
338 | ||
339 | $ aws ec2 authorize-security-group-ingress --group-name MySecurityGroup \ | |
340 | --ip-permissions http://mybucket.s3.amazonaws.com/ip_perms.json | |
341 | ||
342 | -------------- | |
343 | Command Output | |
344 | -------------- | |
345 | ||
346 | The default output for commands is currently JSON. You can use the | |
347 | ``--query`` option to extract the output elements from this JSON document. | |
348 | For more information on the expression language used for the ``--query`` | |
349 | argument, you can read the | |
350 | `JMESPath Tutorial <http://jmespath.org/tutorial.html>`__. | |
351 | ||
352 | ^^^^^^^^ | |
353 | Examples | |
354 | ^^^^^^^^ | |
355 | ||
356 | Get a list of IAM user names:: | |
357 | ||
358 | $ aws iam list-users --query Users[].UserName | |
359 | ||
360 | Get a list of key names and their sizes in an S3 bucket:: | |
361 | ||
362 | $ aws s3api list-objects --bucket b --query Contents[].[Key,Size] | |
363 | ||
364 | Get a list of all EC2 instances and include their Instance ID, State Name, | |
365 | and their Name (if they've been tagged with a Name):: | |
366 | ||
367 | $ aws ec2 describe-instances --query \ | |
368 | 'Reservations[].Instances[].[InstanceId,State.Name,Tags[?Key==`Name`] | [0].Value]' | |
369 | ||
370 | ||
371 | You may also find the `jq <http://stedolan.github.com/jq/>`_ tool useful in | |
372 | processing the JSON output for other uses. | |
373 | ||
374 | There is also an ASCII table format available. You can select this style with | |
375 | the ``--output table`` option or you can make this style your default output | |
376 | style via environment variable or config file entry as described above. | |
377 | Try adding ``--output table`` to the above commands. | |
378 | ||
379 | ||
380 | --------------- | |
381 | CLI Dev Version | |
382 | --------------- | |
383 | ||
384 | If you are just interested in using the latest released version of the AWS CLI, | |
385 | please see the Installation_ section above. This section is for anyone who | |
386 | wants to install the development version of the CLI. You normally would not | |
387 | need to do this unless: | |
388 | ||
389 | * You are developing a feature for the CLI and plan on submitting a Pull | |
390 | Request. | |
391 | * You want to test the latest changes of the CLI before they make it into an | |
392 | official release. | |
393 | ||
394 | The latest changes to the CLI are in the ``develop`` branch on github. This is | |
395 | the default branch when you clone the git repository. | |
396 | ||
397 | Additionally, there are several other packages that are developed in lockstep | |
398 | with the CLI. This includes: | |
399 | ||
400 | * `botocore <https://github.com/boto/botocore>`__ | |
401 | * `jmespath <https://github.com/boto/jmespath>`__ | |
402 | ||
403 | If you just want to install a snapshot of the latest development version of | |
404 | the CLI, you can use the ``requirements.txt`` file included in this repo. | |
405 | This file points to the development version of the above packages:: | |
406 | ||
407 | $ cd <path_to_awscli> | |
408 | $ python -m pip install -r requirements.txt | |
409 | $ python -m pip install -e . | |
410 | ||
411 | However, to keep up to date, you will continually have to run the | |
412 | ``python -m pip install -r requirements.txt`` file to pull in the latest changes | |
413 | from the develop branches of botocore, jmespath, etc. | |
414 | ||
415 | You can optionally clone each of those repositories and run "python -m pip install -e ." | |
416 | for each repository:: | |
417 | ||
418 | $ git clone <jmespath> && cd jmespath/ | |
419 | $ python -m pip install -e . && cd .. | |
420 | $ git clone <botocore> && cd botocore/ | |
421 | $ python -m pip install -e . && cd .. | |
422 | $ git clone <awscli> && cd aws-cli/ | |
423 | $ python -m pip install -e . | |
424 | ||
425 | ||
426 | ------------ | |
427 | Getting Help | |
428 | ------------ | |
429 | ||
430 | We use GitHub issues for tracking bugs and feature requests and have limited | |
431 | bandwidth to address them. Please use these community resources for getting | |
432 | help: | |
433 | ||
434 | * Ask a question on `Stack Overflow <https://stackoverflow.com/>`__ and tag it with `aws-cli <https://stackoverflow.com/questions/tagged/aws-cli>`__ | |
435 | * Come join the AWS CLI community chat on `gitter <https://gitter.im/aws/aws-cli>`__ | |
436 | * Open a support ticket with `AWS Support <https://console.aws.amazon.com/support/home#/>`__ | |
437 | * If it turns out that you may have found a bug, please `open an issue <https://github.com/aws/aws-cli/issues/new>`__ | |
438 | ||
439 | ||
440 | ||
441 | .. _`Amazon Web Services Security Bulletins website`: https://aws.amazon.com/security/security-bulletins | |
442 | .. _pip: https://pip.pypa.io/en/stable/ | |
443 | .. _`download the tarball`: https://pypi.org/project/awscli/ |
16 | 16 | """ |
17 | 17 | import os |
18 | 18 | |
19 | __version__ = '1.18.99' | |
19 | __version__ = '1.18.111' | |
20 | 20 | |
21 | 21 | # |
22 | 22 | # Get our data path to be added to botocore's search path |
339 | 339 | '<code>Name</code> and <code>Args</code>.</p>') |
340 | 340 | |
341 | 341 | EBS_ROOT_VOLUME_SIZE = ( |
342 | '<p>Applies only to Amazon EMR release version 4.0 and earlier. Specifies the size,' | |
342 | '<p>This option is available only with Amazon EMR version 4.x and later. Specifies the size,' | |
343 | 343 | ' in GiB, of the EBS root device volume of the Amazon Linux AMI' |
344 | 344 | ' that is used for each EC2 instance in the cluster. </p>') |
345 | 345 |
0 | **To return information about more than one query** | |
1 | ||
2 | The following ``batch-get-named-query`` example returns information about the named queries that have the specified IDs. :: | |
3 | ||
4 | aws athena batch-get-named-query \ | |
5 | --named-query-ids a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 a1b2c3d4-5678-90ab-cdef-EXAMPLE22222 a1b2c3d4-5678-90ab-cdef-EXAMPLE33333 | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "NamedQueries": [ | |
11 | { | |
12 | "Name": "Flights Select Query", | |
13 | "Description": "Sample query to get the top 10 airports with the most number of departures since 2000", | |
14 | "Database": "sampledb", | |
15 | "QueryString": "SELECT origin, count(*) AS total_departures\nFROM\nflights_parquet\nWHERE year >= '2000'\nGROUP BY origin\nORDER BY total_departures DESC\nLIMIT 10;", | |
16 | "NamedQueryId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
17 | "WorkGroup": "primary" | |
18 | }, | |
19 | { | |
20 | "Name": "Load flights table partitions", | |
21 | "Description": "Sample query to load flights table partitions using MSCK REPAIR TABLE statement", | |
22 | "Database": "sampledb", | |
23 | "QueryString": "MSCK REPAIR TABLE flights_parquet;", | |
24 | "NamedQueryId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", | |
25 | "WorkGroup": "primary" | |
26 | }, | |
27 | { | |
28 | "Name": "CloudFront Select Query", | |
29 | "Description": "Sample query to view requests per operating system during a particular time frame", | |
30 | "Database": "sampledb", | |
31 | "QueryString": "SELECT os, COUNT(*) count FROM cloudfront_logs WHERE date BETWEEN date '2014-07-05' AND date '2014-08-05' GROUP BY os;", | |
32 | "NamedQueryId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", | |
33 | "WorkGroup": "primary" | |
34 | } | |
35 | ], | |
36 | "UnprocessedNamedQueryIds": [] | |
37 | } | |
38 | ||
39 | For more information, see `Running SQL Queries Using Amazon Athena <https://docs.aws.amazon.com/athena/latest/ug/querying-athena-tables.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To return information about one or more query executions** | |
1 | ||
2 | The following ``batch-get-query-execution`` example returns query execution information for the queries that have the specified query IDs. :: | |
3 | ||
4 | aws athena batch-get-query-execution \ | |
5 | --query-execution-ids a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 a1b2c3d4-5678-90ab-cdef-EXAMPLE22222 | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "QueryExecutions": [ | |
11 | { | |
12 | "QueryExecutionId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
13 | "Query": "create database if not exists webdata", | |
14 | "StatementType": "DDL", | |
15 | "ResultConfiguration": { | |
16 | "OutputLocation": "s3://awsdoc-example-bucket/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111.txt" | |
17 | }, | |
18 | "QueryExecutionContext": {}, | |
19 | "Status": { | |
20 | "State": "SUCCEEDED", | |
21 | "SubmissionDateTime": 1593470720.592, | |
22 | "CompletionDateTime": 1593470720.902 | |
23 | }, | |
24 | "Statistics": { | |
25 | "EngineExecutionTimeInMillis": 232, | |
26 | "DataScannedInBytes": 0, | |
27 | "TotalExecutionTimeInMillis": 310, | |
28 | "ResultConfiguration": { | |
29 | ||
30 | "QueryQueueTimeInMillis": 50, | |
31 | "ServiceProcessingTimeInMillis": 28 | |
32 | }, | |
33 | "WorkGroup": "AthenaAdmin" | |
34 | }, | |
35 | { | |
36 | "QueryExecutionId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", | |
37 | "Query": "select date, location, browser, uri, status from cloudfront_logs where method = 'GET' and status = 200 and location like 'SFO%' limit 10", | |
38 | "StatementType": "DML", | |
39 | "ResultConfiguration": { | |
40 | "OutputLocation": "s3://awsdoc-example-bucket/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222.csv" | |
41 | }, | |
42 | "QueryExecutionContext": { | |
43 | "Database": "mydatabase", | |
44 | "Catalog": "awsdatacatalog" | |
45 | }, | |
46 | "Status": { | |
47 | "State": "SUCCEEDED", | |
48 | "SubmissionDateTime": 1593469842.665, | |
49 | "CompletionDateTime": 1593469846.486 | |
50 | }, | |
51 | "Statistics": { | |
52 | "EngineExecutionTimeInMillis": 3600, | |
53 | "DataScannedInBytes": 203089, | |
54 | "TotalExecutionTimeInMillis": 3821, | |
55 | "QueryQueueTimeInMillis": 267, | |
56 | "QueryPlanningTimeInMillis": 1175 | |
57 | }, | |
58 | "WorkGroup": "AthenaAdmin" | |
59 | } | |
60 | ], | |
61 | "UnprocessedQueryExecutionIds": [] | |
62 | } | |
63 | ||
64 | For more information, see `Running SQL Queries Using Amazon Athena <https://docs.aws.amazon.com/athena/latest/ug/querying-athena-tables.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To create a data catalog** | |
1 | ||
2 | The following ``create-data-catalog`` example creates the ``dynamo_db_catalog`` data catalog. :: | |
3 | ||
4 | aws athena create-data-catalog \ | |
5 | --name dynamo_db_catalog \ | |
6 | --type LAMBDA \ | |
7 | --description "DynamoDB Catalog" \ | |
8 | --function=arn:aws:lambda:us-west-2:111122223333:function:dynamo_db_lambda | |
9 | ||
10 | This command produces no output. To see the result, use ``aws athena get-data-catalog --name dynamo_db_catalog``. | |
11 | ||
12 | For more information, see `Registering a Catalog: create-data-catalog <https://docs.aws.amazon.com/athena/latest/ug/datastores-hive-cli.html#datastores-hive-cli-registering-a-catalog>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To create a named query** | |
1 | ||
2 | The following ``create-named-query`` example creates a saved query in the ``AthenaAdmin`` workgroup that queries the ``flights_parquet`` table for flights from Seattle to New York in January, 2016 whose departure and arrival were both delayed by more than ten minutes. Because the airport code values in the table are strings that include double quotes (for example, "SEA"), they are escaped by backslashes and surrounded by single quotes. :: | |
3 | ||
4 | aws athena create-named-query \ | |
5 | --name "SEA to JFK delayed flights Jan 2016" \ | |
6 | --description "Both arrival and departure delayed more than 10 minutes." \ | |
7 | --database sampledb \ | |
8 | --query-string "SELECT flightdate, carrier, flightnum, origin, dest, depdelayminutes, arrdelayminutes FROM sampledb.flights_parquet WHERE yr = 2016 AND month = 1 AND origin = '\"SEA\"' AND dest = '\"JFK\"' AND depdelayminutes > 10 AND arrdelayminutes > 10" \ | |
9 | --work-group AthenaAdmin | |
10 | ||
11 | Output:: | |
12 | ||
13 | { | |
14 | "NamedQueryId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" | |
15 | } | |
16 | ||
17 | For more information, see `Running SQL Queries Using Amazon Athena <https://docs.aws.amazon.com/athena/latest/ug/querying-athena-tables.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To create a workgroup** | |
1 | ||
2 | The following ``create-work-group`` example creates a workgroup called ``Data_Analyst_Group`` that has the query results output location ``s3://awsdoc-example-bucket``. The command creates a workgroup that overrides client configuration settings, which includes the query results output location. The command also enables CloudWatch metrics and adds three key-value tag pairs to the workgroup to distinguish it from other workgroups. Note that the ``--configuration`` argument has no spaces before the commas that separate its options. :: | |
3 | ||
4 | aws athena create-work-group \ | |
5 | --name Data_Analyst_Group \ | |
6 | --configuration ResultConfiguration={OutputLocation="s3://awsdoc-example-bucket"},EnforceWorkGroupConfiguration="true",PublishCloudWatchMetricsEnabled="true" \ | |
7 | --description "Workgroup for data analysts" \ | |
8 | --tags Key=Division,Value=West Key=Location,Value=Seattle Key=Team,Value="Big Data" | |
9 | ||
10 | This command produces no output. To see the results, use ``aws athena get-work-group --work-group Data_Analyst_Group``. | |
11 | ||
12 | For more information, see `Managing Workgroups <https://docs.aws.amazon.com/athena/latest/ug/workgroups-create-update-delete.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To delete a data catalog** | |
1 | ||
2 | The following ``delete-data-catalog`` example deletes the ``UnusedDataCatalog`` data catalog. :: | |
3 | ||
4 | aws athena delete-data-catalog \ | |
5 | --name UnusedDataCatalog | |
6 | ||
7 | This command produces no output. | |
8 | ||
9 | For more information, see `Deleting a Catalog: delete-data-catalog <https://docs.aws.amazon.com/athena/latest/ug/datastores-hive-cli.html#datastores-hive-cli-deleting-a-catalog>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To delete a named query** | |
1 | ||
2 | The following ``delete-named-query`` example deletes the named query that has the specified ID. :: | |
3 | ||
4 | aws athena delete-named-query \ | |
5 | --named-query-id a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 | |
6 | ||
7 | This command produces no output. | |
8 | ||
9 | For more information, see `Running SQL Queries Using Amazon Athena <https://docs.aws.amazon.com/athena/latest/ug/querying-athena-tables.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To delete a workgroup** | |
1 | ||
2 | The following ``delete-work-group`` example deletes the ``TeamB`` workgroup. :: | |
3 | ||
4 | aws athena delete-work-group \ | |
5 | --work-group TeamB | |
6 | ||
7 | This command produces no output. To confirm the deletion, use ``aws athena list-work-groups``. | |
8 | ||
9 | For more information, see `Managing Workgroups <https://docs.aws.amazon.com/athena/latest/ug/workgroups-create-update-delete.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To return information about a data catalog** | |
1 | ||
2 | The following ``get-data-catalog`` example returns information about the ``dynamo_db_catalog`` data catalog. :: | |
3 | ||
4 | aws athena get-data-catalog \ | |
5 | --name dynamo_db_catalog | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "DataCatalog": { | |
11 | "Name": "dynamo_db_catalog", | |
12 | "Description": "DynamoDB Catalog", | |
13 | "Type": "LAMBDA", | |
14 | "Parameters": { | |
15 | "catalog": "dynamo_db_catalog", | |
16 | "metadata-function": "arn:aws:lambda:us-west-2:111122223333:function:dynamo_db_lambda", | |
17 | "record-function": "arn:aws:lambda:us-west-2:111122223333:function:dynamo_db_lambda" | |
18 | } | |
19 | } | |
20 | } | |
21 | ||
22 | For more information, see `Showing Catalog Details: get-data-catalog <https://docs.aws.amazon.com/athena/latest/ug/datastores-hive-cli.html#datastores-hive-cli-showing-details-of-a-catalog>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To return information about a database in a data catalog** | |
1 | ||
2 | The following ``get-database`` example returns information about the ``sampledb`` database in the ``AwsDataCatalog`` data catalog. :: | |
3 | ||
4 | aws athena get-database \ | |
5 | --catalog-name AwsDataCatalog \ | |
6 | --database-name sampledb | |
7 | ||
8 | Output:: | |
9 | ||
10 | { | |
11 | "Database": { | |
12 | "Name": "sampledb", | |
13 | "Description": "Sample database", | |
14 | "Parameters": { | |
15 | "CreatedBy": "Athena", | |
16 | "EXTERNAL": "TRUE" | |
17 | } | |
18 | } | |
19 | } | |
20 | ||
21 | For more information, see `Showing Database Details: get-database <https://docs.aws.amazon.com/athena/latest/ug/datastores-hive-cli.html#datastores-hive-cli-showing-details-of-a-database>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To return a named query** | |
1 | ||
2 | The following ``get-named-query`` example returns information about the query that has the specified ID. :: | |
3 | ||
4 | aws athena get-named-query \ | |
5 | --named-query-id a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "NamedQuery": { | |
11 | "Name": "CloudFront Logs - SFO", | |
12 | "Description": "Shows successful GET request data for SFO", | |
13 | "Database": "default", | |
14 | "QueryString": "select date, location, browser, uri, status from cloudfront_logs where method = 'GET' and status = 200 and location like 'SFO%' limit 10", | |
15 | "NamedQueryId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
16 | "WorkGroup": "AthenaAdmin" | |
17 | } | |
18 | } | |
19 | ||
20 | For more information, see `Running SQL Queries Using Amazon Athena <https://docs.aws.amazon.com/athena/latest/ug/querying-athena-tables.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To return information about a query execution** | |
1 | ||
2 | The following ``get-query-execution`` example returns information about the query that has the specified query ID. :: | |
3 | ||
4 | aws athena get-query-execution \ | |
5 | --query-execution-id a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "QueryExecution": { | |
11 | "QueryExecutionId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
12 | "Query": "select date, location, browser, uri, status from cloudfront_logs where method = 'GET | |
13 | ' and status = 200 and location like 'SFO%' limit 10", | |
14 | "StatementType": "DML", | |
15 | "ResultConfiguration": { | |
16 | "OutputLocation": "s3://awsdoc-example-bucket/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111.csv" | |
17 | }, | |
18 | "QueryExecutionContext": { | |
19 | "Database": "mydatabase", | |
20 | "Catalog": "awsdatacatalog" | |
21 | }, | |
22 | "Status": { | |
23 | "State": "SUCCEEDED", | |
24 | "SubmissionDateTime": 1593469842.665, | |
25 | "CompletionDateTime": 1593469846.486 | |
26 | }, | |
27 | "Statistics": { | |
28 | "EngineExecutionTimeInMillis": 3600, | |
29 | "DataScannedInBytes": 203089, | |
30 | "TotalExecutionTimeInMillis": 3821, | |
31 | "QueryQueueTimeInMillis": 267, | |
32 | "QueryPlanningTimeInMillis": 1175 | |
33 | }, | |
34 | "WorkGroup": "AthenaAdmin" | |
35 | } | |
36 | } | |
37 | ||
38 | For more information, see `Running SQL Queries Using Amazon Athena <https://docs.aws.amazon.com/athena/latest/ug/querying-athena-tables.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To return the results of a query** | |
1 | ||
2 | The following ``get-query-results`` example returns the results of the query that has the specified query ID. :: | |
3 | ||
4 | aws athena get-query-results \ | |
5 | --query-execution-id a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "ResultSet": { | |
11 | "Rows": [ | |
12 | { | |
13 | "Data": [ | |
14 | { | |
15 | "VarCharValue": "date" | |
16 | }, | |
17 | { | |
18 | "VarCharValue": "location" | |
19 | }, | |
20 | { | |
21 | "VarCharValue": "browser" | |
22 | }, | |
23 | { | |
24 | "VarCharValue": "uri" | |
25 | }, | |
26 | { | |
27 | "VarCharValue": "status" | |
28 | } | |
29 | ] | |
30 | }, | |
31 | { | |
32 | "Data": [ | |
33 | { | |
34 | "VarCharValue": "2014-07-05" | |
35 | }, | |
36 | { | |
37 | "VarCharValue": "SFO4" | |
38 | }, | |
39 | { | |
40 | "VarCharValue": "Safari" | |
41 | }, | |
42 | { | |
43 | "VarCharValue": "/test-image-2.jpeg" | |
44 | }, | |
45 | { | |
46 | "VarCharValue": "200" | |
47 | } | |
48 | ] | |
49 | }, | |
50 | { | |
51 | "Data": [ | |
52 | { | |
53 | "VarCharValue": "2014-07-05" | |
54 | }, | |
55 | { | |
56 | "VarCharValue": "SFO4" | |
57 | }, | |
58 | { | |
59 | "VarCharValue": "Opera" | |
60 | }, | |
61 | { | |
62 | "VarCharValue": "/test-image-2.jpeg" | |
63 | }, | |
64 | { | |
65 | "VarCharValue": "200" | |
66 | } | |
67 | ] | |
68 | }, | |
69 | { | |
70 | "Data": [ | |
71 | { | |
72 | "VarCharValue": "2014-07-05" | |
73 | }, | |
74 | { | |
75 | "VarCharValue": "SFO4" | |
76 | }, | |
77 | { | |
78 | "VarCharValue": "Firefox" | |
79 | }, | |
80 | { | |
81 | "VarCharValue": "/test-image-3.jpeg" | |
82 | }, | |
83 | { | |
84 | "VarCharValue": "200" | |
85 | } | |
86 | ] | |
87 | }, | |
88 | { | |
89 | "Data": [ | |
90 | { | |
91 | "VarCharValue": "2014-07-05" | |
92 | }, | |
93 | { | |
94 | "VarCharValue": "SFO4" | |
95 | }, | |
96 | { | |
97 | "VarCharValue": "Lynx" | |
98 | }, | |
99 | { | |
100 | "VarCharValue": "/test-image-3.jpeg" | |
101 | }, | |
102 | { | |
103 | "VarCharValue": "200" | |
104 | } | |
105 | ] | |
106 | }, | |
107 | { | |
108 | "Data": [ | |
109 | { | |
110 | "VarCharValue": "2014-07-05" | |
111 | }, | |
112 | { | |
113 | "VarCharValue": "SFO4" | |
114 | }, | |
115 | { | |
116 | "VarCharValue": "IE" | |
117 | }, | |
118 | { | |
119 | "VarCharValue": "/test-image-2.jpeg" | |
120 | }, | |
121 | { | |
122 | "VarCharValue": "200" | |
123 | } | |
124 | ] | |
125 | }, | |
126 | { | |
127 | "Data": [ | |
128 | { | |
129 | "VarCharValue": "2014-07-05" | |
130 | }, | |
131 | { | |
132 | "VarCharValue": "SFO4" | |
133 | }, | |
134 | { | |
135 | "VarCharValue": "Opera" | |
136 | }, | |
137 | { | |
138 | "VarCharValue": "/test-image-1.jpeg" | |
139 | }, | |
140 | { | |
141 | "VarCharValue": "200" | |
142 | } | |
143 | ] | |
144 | }, | |
145 | { | |
146 | "Data": [ | |
147 | { | |
148 | "VarCharValue": "2014-07-05" | |
149 | }, | |
150 | { | |
151 | "VarCharValue": "SFO4" | |
152 | }, | |
153 | { | |
154 | "VarCharValue": "Chrome" | |
155 | }, | |
156 | { | |
157 | "VarCharValue": "/test-image-3.jpeg" | |
158 | }, | |
159 | { | |
160 | "VarCharValue": "200" | |
161 | } | |
162 | ] | |
163 | }, | |
164 | { | |
165 | "Data": [ | |
166 | { | |
167 | "VarCharValue": "2014-07-05" | |
168 | }, | |
169 | { | |
170 | "VarCharValue": "SFO4" | |
171 | }, | |
172 | { | |
173 | "VarCharValue": "Firefox" | |
174 | }, | |
175 | { | |
176 | "VarCharValue": "/test-image-2.jpeg" | |
177 | }, | |
178 | { | |
179 | "VarCharValue": "200" | |
180 | } | |
181 | ] | |
182 | }, | |
183 | { | |
184 | "Data": [ | |
185 | { | |
186 | "VarCharValue": "2014-07-05" | |
187 | }, | |
188 | { | |
189 | "VarCharValue": "SFO4" | |
190 | }, | |
191 | { | |
192 | "VarCharValue": "Chrome" | |
193 | }, | |
194 | { | |
195 | "VarCharValue": "/test-image-3.jpeg" | |
196 | }, | |
197 | { | |
198 | "VarCharValue": "200" | |
199 | } | |
200 | ] | |
201 | }, | |
202 | { | |
203 | "Data": [ | |
204 | { | |
205 | "VarCharValue": "2014-07-05" | |
206 | }, | |
207 | { | |
208 | "VarCharValue": "SFO4" | |
209 | }, | |
210 | { | |
211 | "VarCharValue": "IE" | |
212 | }, | |
213 | { | |
214 | "VarCharValue": "/test-image-2.jpeg" | |
215 | }, | |
216 | { | |
217 | "VarCharValue": "200" | |
218 | } | |
219 | ] | |
220 | } | |
221 | ], | |
222 | "ResultSetMetadata": { | |
223 | "ColumnInfo": [ | |
224 | { | |
225 | "CatalogName": "hive", | |
226 | "SchemaName": "", | |
227 | "TableName": "", | |
228 | "Name": "date", | |
229 | "Label": "date", | |
230 | "Type": "date", | |
231 | "Precision": 0, | |
232 | "Scale": 0, | |
233 | "Nullable": "UNKNOWN", | |
234 | "CaseSensitive": false | |
235 | }, | |
236 | { | |
237 | "CatalogName": "hive", | |
238 | "SchemaName": "", | |
239 | "TableName": "", | |
240 | "Name": "location", | |
241 | "Label": "location", | |
242 | "Type": "varchar", | |
243 | "Precision": 2147483647, | |
244 | "Data": [ | |
245 | ||
246 | "Scale": 0, | |
247 | "Nullable": "UNKNOWN", | |
248 | "CaseSensitive": true | |
249 | }, | |
250 | { | |
251 | "CatalogName": "hive", | |
252 | "SchemaName": "", | |
253 | "TableName": "", | |
254 | "Name": "browser", | |
255 | "Label": "browser", | |
256 | "Type": "varchar", | |
257 | "Precision": 2147483647, | |
258 | "Scale": 0, | |
259 | "Nullable": "UNKNOWN", | |
260 | "CaseSensitive": true | |
261 | }, | |
262 | { | |
263 | "CatalogName": "hive", | |
264 | "SchemaName": "", | |
265 | "TableName": "", | |
266 | "Name": "uri", | |
267 | "Label": "uri", | |
268 | "Type": "varchar", | |
269 | "Precision": 2147483647, | |
270 | "Scale": 0, | |
271 | "Nullable": "UNKNOWN", | |
272 | "CaseSensitive": true | |
273 | }, | |
274 | { | |
275 | "CatalogName": "hive", | |
276 | "SchemaName": "", | |
277 | "TableName": "", | |
278 | "Name": "status", | |
279 | "Label": "status", | |
280 | "Type": "integer", | |
281 | "Precision": 10, | |
282 | "Scale": 0, | |
283 | "Nullable": "UNKNOWN", | |
284 | "CaseSensitive": false | |
285 | } | |
286 | ] | |
287 | } | |
288 | }, | |
289 | "UpdateCount": 0 | |
290 | } | |
291 | ||
292 | For more information, see `Working with Query Results, Output Files, and Query History <https://docs.aws.amazon.com/athena/latest/ug/querying.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To return metadata information about a table** | |
1 | ||
2 | The following ``get-table-metadata`` example returns metadata information about the ``counties`` table, including including column names and their datatypes, from the ``sampledb`` database of the ``AwsDataCatalog`` data catalog. :: | |
3 | ||
4 | aws athena get-table-metadata \ | |
5 | --catalog-name AwsDataCatalog \ | |
6 | --database-name sampledb \ | |
7 | --table-name counties | |
8 | ||
9 | Output:: | |
10 | ||
11 | { | |
12 | "TableMetadata": { | |
13 | "Name": "counties", | |
14 | "CreateTime": 1593559968.0, | |
15 | "LastAccessTime": 0.0, | |
16 | "TableType": "EXTERNAL_TABLE", | |
17 | "Columns": [ | |
18 | { | |
19 | "Name": "name", | |
20 | "Type": "string", | |
21 | "Comment": "from deserializer" | |
22 | }, | |
23 | { | |
24 | "Name": "boundaryshape", | |
25 | "Type": "binary", | |
26 | "Comment": "from deserializer" | |
27 | }, | |
28 | { | |
29 | "Name": "motto", | |
30 | "Type": "string", | |
31 | "Comment": "from deserializer" | |
32 | }, | |
33 | { | |
34 | "Name": "population", | |
35 | "Type": "int", | |
36 | "Comment": "from deserializer" | |
37 | } | |
38 | ], | |
39 | "PartitionKeys": [], | |
40 | "Parameters": { | |
41 | "EXTERNAL": "TRUE", | |
42 | "inputformat": "com.esri.json.hadoop.EnclosedJsonInputFormat", | |
43 | "location": "s3://awsdoc-example-bucket/json", | |
44 | "outputformat": "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat", | |
45 | "serde.param.serialization.format": "1", | |
46 | "serde.serialization.lib": "com.esri.hadoop.hive.serde.JsonSerde", | |
47 | "transient_lastDdlTime": "1593559968" | |
48 | } | |
49 | } | |
50 | } | |
51 | ||
52 | For more information, see `Showing Table Details: get-table-metadata <https://docs.aws.amazon.com/athena/latest/ug/datastores-hive-cli.html#datastores-hive-cli-showing-details-of-a-table>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To return information about a workgroup** | |
1 | ||
2 | The following ``get-work-group`` example returns information about the ``AthenaAdmin`` workgroup. :: | |
3 | ||
4 | aws athena get-work-group \ | |
5 | --work-group AthenaAdmin | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "WorkGroup": { | |
11 | "Name": "AthenaAdmin", | |
12 | "State": "ENABLED", | |
13 | "Configuration": { | |
14 | "ResultConfiguration": { | |
15 | "OutputLocation": "s3://awsdoc-example-bucket/" | |
16 | }, | |
17 | "EnforceWorkGroupConfiguration": false, | |
18 | "PublishCloudWatchMetricsEnabled": true, | |
19 | "RequesterPaysEnabled": false | |
20 | }, | |
21 | "Description": "Workgroup for Athena administrators", | |
22 | "CreationTime": 1573677174.105 | |
23 | } | |
24 | } | |
25 | ||
26 | For more information, see `Managing Workgroups <https://docs.aws.amazon.com/athena/latest/ug/workgroups-create-update-delete.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To list the data catalogs registered with Athena** | |
1 | ||
2 | The following ``list-data-catalogs`` example lists the data catalogs registered with Athena. :: | |
3 | ||
4 | aws athena list-data-catalogs | |
5 | ||
6 | Output:: | |
7 | ||
8 | { | |
9 | "DataCatalogsSummary": [ | |
10 | { | |
11 | "CatalogName": "AwsDataCatalog", | |
12 | "Type": "GLUE" | |
13 | }, | |
14 | { | |
15 | "CatalogName": "cw_logs_catalog", | |
16 | "Type": "LAMBDA" | |
17 | }, | |
18 | { | |
19 | "CatalogName": "cw_metrics_catalog", | |
20 | "Type": "LAMBDA" | |
21 | } | |
22 | ] | |
23 | } | |
24 | ||
25 | For more information, see `Listing Registered Catalogs: list-data-catalogs <https://docs.aws.amazon.com/athena/latest/ug/datastores-hive-cli.html#datastores-hive-cli-listing-registered-catalogs>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To list the databases in a data catalog** | |
1 | ||
2 | The following ``list-databases`` example lists the databases in the ``AwsDataCatalog`` data catalog. :: | |
3 | ||
4 | aws athena list-databases \ | |
5 | --catalog-name AwsDataCatalog | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "DatabaseList": [ | |
11 | { | |
12 | "Name": "default" | |
13 | }, | |
14 | { | |
15 | "Name": "mydatabase" | |
16 | }, | |
17 | { | |
18 | "Name": "newdb" | |
19 | }, | |
20 | { | |
21 | "Name": "sampledb", | |
22 | "Description": "Sample database", | |
23 | "Parameters": { | |
24 | "CreatedBy": "Athena", | |
25 | "EXTERNAL": "TRUE" | |
26 | } | |
27 | }, | |
28 | { | |
29 | "Name": "webdata" | |
30 | } | |
31 | ] | |
32 | } | |
33 | ||
34 | For more information, see `Listing Databases in a Catalog: list-databases <https://docs.aws.amazon.com/athena/latest/ug/datastores-hive-cli.html#datastores-hive-cli-listing-databases>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To list the named queries for a workgroup** | |
1 | ||
2 | The following ``list-named-queries`` example lists the named queries for the ``AthenaAdmin`` workgroup. :: | |
3 | ||
4 | aws athena list-named-queries \ | |
5 | --work-group AthenaAdmin | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "NamedQueryIds": [ | |
11 | "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
12 | "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", | |
13 | "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333" | |
14 | ] | |
15 | } | |
16 | ||
17 | For more information, see `Running SQL Queries Using Amazon Athena <https://docs.aws.amazon.com/athena/latest/ug/querying-athena-tables.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To list the query IDs of the queries in a specified workgroup** | |
1 | ||
2 | The following ``list-query-executions`` example lists a maximum of ten of the query IDs in the ``AthenaAdmin`` workgroup. :: | |
3 | ||
4 | aws athena list-query-executions \ | |
5 | --work-group AthenaAdmin \ | |
6 | --max-items 10 | |
7 | ||
8 | Output:: | |
9 | ||
10 | { | |
11 | "QueryExecutionIds": [ | |
12 | "a1b2c3d4-5678-90ab-cdef-EXAMPLE11110", | |
13 | "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
14 | "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", | |
15 | "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", | |
16 | "a1b2c3d4-5678-90ab-cdef-EXAMPLE11114", | |
17 | "a1b2c3d4-5678-90ab-cdef-EXAMPLE11115", | |
18 | "a1b2c3d4-5678-90ab-cdef-EXAMPLE11116", | |
19 | "a1b2c3d4-5678-90ab-cdef-EXAMPLE11117", | |
20 | "a1b2c3d4-5678-90ab-cdef-EXAMPLE11118", | |
21 | "a1b2c3d4-5678-90ab-cdef-EXAMPLE11119" | |
22 | ], | |
23 | "NextToken": "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAxMH0=" | |
24 | } | |
25 | ||
26 | For more information, see `Working with Query Results, Output Files, and Query History <https://docs.aws.amazon.com/athena/latest/ug/querying.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To list the metadata for tables in the specified database of a data catalog** | |
1 | ||
2 | The following ``list-table-metadata`` example returns metadata information for a maximum of two tables in the ``geography`` database of the ``AwsDataCatalog`` data catalog. :: | |
3 | ||
4 | aws athena list-table-metadata \ | |
5 | --catalog-name AwsDataCatalog \ | |
6 | --database-name geography \ | |
7 | --max-items 2 | |
8 | ||
9 | Output:: | |
10 | ||
11 | { | |
12 | "TableMetadataList": [ | |
13 | { | |
14 | "Name": "country_codes", | |
15 | "CreateTime": 1586553454.0, | |
16 | "TableType": "EXTERNAL_TABLE", | |
17 | "Columns": [ | |
18 | { | |
19 | "Name": "country", | |
20 | "Type": "string", | |
21 | "Comment": "geo id" | |
22 | }, | |
23 | { | |
24 | "Name": "alpha-2 code", | |
25 | "Type": "string", | |
26 | "Comment": "geo id2" | |
27 | }, | |
28 | { | |
29 | "Name": "alpha-3 code", | |
30 | "Type": "string", | |
31 | "Comment": "state name" | |
32 | }, | |
33 | { | |
34 | "Name": "numeric code", | |
35 | "Type": "bigint", | |
36 | "Comment": "" | |
37 | }, | |
38 | { | |
39 | "Name": "latitude", | |
40 | "Type": "bigint", | |
41 | "Comment": "location (latitude)" | |
42 | }, | |
43 | { | |
44 | "Name": "longitude", | |
45 | "Type": "bigint", | |
46 | "Comment": "location (longitude)" | |
47 | } | |
48 | ], | |
49 | "Parameters": { | |
50 | "areColumnsQuoted": "false", | |
51 | "classification": "csv", | |
52 | "columnsOrdered": "true", | |
53 | "delimiter": ",", | |
54 | "has_encrypted_data": "false", | |
55 | "inputformat": "org.apache.hadoop.mapred.TextInputFormat", | |
56 | "location": "s3://awsdoc-example-bucket/csv/countrycode", | |
57 | "outputformat": "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat", | |
58 | "serde.param.field.delim": ",", | |
59 | "serde.serialization.lib": "org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe", | |
60 | "skip.header.line.count": "1", | |
61 | "typeOfData": "file" | |
62 | } | |
63 | }, | |
64 | { | |
65 | "Name": "county_populations", | |
66 | "CreateTime": 1586553446.0, | |
67 | "TableType": "EXTERNAL_TABLE", | |
68 | "Columns": [ | |
69 | { | |
70 | "Name": "id", | |
71 | "Type": "string", | |
72 | "Comment": "geo id" | |
73 | }, | |
74 | { | |
75 | "Name": "country", | |
76 | ||
77 | "Name": "id2", | |
78 | "Type": "string", | |
79 | "Comment": "geo id2" | |
80 | }, | |
81 | { | |
82 | "Name": "county", | |
83 | "Type": "string", | |
84 | "Comment": "county name" | |
85 | }, | |
86 | { | |
87 | "Name": "state", | |
88 | "Type": "string", | |
89 | "Comment": "state name" | |
90 | }, | |
91 | { | |
92 | "Name": "population estimate 2018", | |
93 | "Type": "string", | |
94 | "Comment": "" | |
95 | } | |
96 | ], | |
97 | "Parameters": { | |
98 | "areColumnsQuoted": "false", | |
99 | "classification": "csv", | |
100 | "columnsOrdered": "true", | |
101 | "delimiter": ",", | |
102 | "has_encrypted_data": "false", | |
103 | "inputformat": "org.apache.hadoop.mapred.TextInputFormat", | |
104 | "location": "s3://awsdoc-example-bucket/csv/CountyPopulation", | |
105 | "outputformat": "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat", | |
106 | "serde.param.field.delim": ",", | |
107 | "serde.serialization.lib": "org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe", | |
108 | "skip.header.line.count": "1", | |
109 | "typeOfData": "file" | |
110 | } | |
111 | } | |
112 | ], | |
113 | "NextToken": "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAyfQ==" | |
114 | } | |
115 | ||
116 | For more information, see `Showing Metadata for All Tables in a Database: list-table-metadata <https://docs.aws.amazon.com/athena/latest/ug/datastores-hive-cli.html#datastores-hive-cli-showing-all-table-metadata>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **Example 1: To list the tags for a workgroup** | |
1 | ||
2 | The following ``list-tags-for-resource`` example lists the tags for the ``Data_Analyst_Group`` workgroup. :: | |
3 | ||
4 | aws athena list-tags-for-resource \ | |
5 | --resource-arn arn:aws:athena:us-west-2:111122223333:workgroup/Data_Analyst_Group | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "Tags": [ | |
11 | { | |
12 | "Key": "Division", | |
13 | "Value": "West" | |
14 | }, | |
15 | { | |
16 | "Key": "Team", | |
17 | "Value": "Big Data" | |
18 | }, | |
19 | { | |
20 | "Key": "Location", | |
21 | "Value": "Seattle" | |
22 | } | |
23 | ] | |
24 | } | |
25 | ||
26 | **Example 2: To list the tags for a data catalog** | |
27 | ||
28 | The following ``list-tags-for-resource`` example lists the tags for the ``dynamo_db_catalog`` data catalog. :: | |
29 | ||
30 | aws athena list-tags-for-resource \ | |
31 | --resource-arn arn:aws:athena:us-west-2:111122223333:datacatalog/dynamo_db_catalog | |
32 | ||
33 | Output:: | |
34 | ||
35 | { | |
36 | "Tags": [ | |
37 | { | |
38 | "Key": "Division", | |
39 | "Value": "Mountain" | |
40 | }, | |
41 | { | |
42 | "Key": "Organization", | |
43 | "Value": "Retail" | |
44 | }, | |
45 | { | |
46 | "Key": "Product_Line", | |
47 | "Value": "Shoes" | |
48 | }, | |
49 | { | |
50 | "Key": "Location", | |
51 | "Value": "Denver" | |
52 | } | |
53 | ] | |
54 | } | |
55 | ||
56 | For more information, see `Listing the tags for a resource: list-tags-for-resource <https://docs.aws.amazon.com/athena/latest/ug/tags-operations.html#tags-operations-examples-cli-list-tags-for-resource>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To list workgroups** | |
1 | ||
2 | The following ``list-work-groups`` example lists the workgroups in the current account. :: | |
3 | ||
4 | aws athena list-work-groups | |
5 | ||
6 | Output:: | |
7 | ||
8 | { | |
9 | "WorkGroups": [ | |
10 | { | |
11 | "Name": "Data_Analyst_Group", | |
12 | "State": "ENABLED", | |
13 | "Description": "", | |
14 | "CreationTime": 1578006683.016 | |
15 | }, | |
16 | { | |
17 | "Name": "AthenaAdmin", | |
18 | "State": "ENABLED", | |
19 | "Description": "", | |
20 | "CreationTime": 1573677174.105 | |
21 | }, | |
22 | { | |
23 | "Name": "primary", | |
24 | "State": "ENABLED", | |
25 | "Description": "", | |
26 | "CreationTime": 1567465222.723 | |
27 | } | |
28 | ] | |
29 | } | |
30 | ||
31 | For more information, see `Managing Workgroups <https://docs.aws.amazon.com/athena/latest/ug/workgroups-create-update-delete.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **Example 1: To run a query in a workgroup on the specified table in the specified database and data catalog** | |
1 | ||
2 | The following ``start-query-execution`` example uses the ``AthenaAdmin`` workgroup to run a query on the ``cloudfront_logs`` table in the ``cflogsdatabase`` in the ``AwsDataCatalog`` data catalog. :: | |
3 | ||
4 | aws athena start-query-execution \ | |
5 | --query-string "select date, location, browser, uri, status from cloudfront_logs where method = 'GET' and status = 200 and location like 'SFO%' limit 10" \ | |
6 | --work-group "AthenaAdmin" \ | |
7 | --query-execution-context Database=cflogsdatabase,Catalog=AwsDataCatalog | |
8 | ||
9 | Output:: | |
10 | ||
11 | { | |
12 | "QueryExecutionId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" | |
13 | } | |
14 | ||
15 | For more information, see `Running SQL Queries Using Amazon Athena <https://docs.aws.amazon.com/athena/latest/ug/querying-athena-tables.html>`__ in the *Amazon Athena User Guide*. | |
16 | ||
17 | **Example 2: To run a query that uses a specified workgroup to create a database in the specified data catalog** | |
18 | ||
19 | The following ``start-query-execution`` example uses the ``AthenaAdmin`` workgroup to create the database ``newdb`` in the default data catalog ``AwsDataCatalog``. :: | |
20 | ||
21 | aws athena start-query-execution \ | |
22 | --query-string "create database if not exists newdb" \ | |
23 | --work-group "AthenaAdmin" | |
24 | ||
25 | Output:: | |
26 | ||
27 | { | |
28 | "QueryExecutionId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11112" | |
29 | } | |
30 | ||
31 | For more information, see `Running SQL Queries Using Amazon Athena <https://docs.aws.amazon.com/athena/latest/ug/querying-athena-tables.html>`__ in the *Amazon Athena User Guide*. | |
32 | ||
33 | **Example 3: To run a query that creates a view on a table in the specified database and data catalog** | |
34 | ||
35 | The following ``start-query-execution`` example uses a ``SELECT`` statement on the ``cloudfront_logs`` table in the ``cflogsdatabase`` to create the view ``cf10``. :: | |
36 | ||
37 | aws athena start-query-execution \ | |
38 | --query-string "CREATE OR REPLACE VIEW cf10 AS SELECT * FROM cloudfront_logs limit 10" \ | |
39 | --query-execution-context Database=cflogsdatabase | |
40 | ||
41 | Output:: | |
42 | ||
43 | { | |
44 | "QueryExecutionId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11113" | |
45 | } | |
46 | ||
47 | For more information, see `Running SQL Queries Using Amazon Athena <https://docs.aws.amazon.com/athena/latest/ug/querying-athena-tables.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To stop a running query** | |
1 | ||
2 | The following ``stop-query-execution`` example stops the query that has the specified query ID. :: | |
3 | ||
4 | aws athena stop-query-execution \ | |
5 | --query-execution-id a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 | |
6 | ||
7 | This command produces no output. | |
8 | ||
9 | For more information, see `Running SQL Queries Using Amazon Athena <https://docs.aws.amazon.com/athena/latest/ug/querying-athena-tables.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To add a tag to a resource** | |
1 | ||
2 | The following ``tag-resource`` example adds three tags to the ``dynamo_db_catalog`` data catalog. :: | |
3 | ||
4 | aws athena tag-resource \ | |
5 | --resource-arn arn:aws:athena:us-west-2:111122223333:datacatalog/dynamo_db_catalog \ | |
6 | --tags Key=Organization,Value=Retail Key=Division,Value=Mountain Key=Product_Line,Value=Shoes Key=Location,Value=Denver | |
7 | ||
8 | This command produces no output. To see the result, use ``aws athena list-tags-for-resource --resource-arn arn:aws:athena:us-west-2:111122223333:datacatalog/dynamo_db_catalog``. | |
9 | ||
10 | For more information, see `Adding tags to a resource: tag-resource <https://docs.aws.amazon.com/athena/latest/ug/tags-operations.html#tags-operations-examples-cli-tag-resource>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To remove a tag from a resource** | |
1 | ||
2 | The following ``untag-resource`` example removes the ``Specialization`` and ``Focus`` keys and their associated values from the ``dynamo_db_catalog`` data catalog resource. :: | |
3 | ||
4 | aws athena untag-resource \ | |
5 | --resource-arn arn:aws:athena:us-west-2:111122223333:datacatalog/dynamo_db_catalog \ | |
6 | --tag-keys Specialization Focus | |
7 | ||
8 | This command produces no output. To see the results, use the ``list-tags-for-resource`` command. | |
9 | ||
10 | For more information, see `Removing tags from a resource: untag-resource <https://docs.aws.amazon.com/athena/latest/ug/tags-operations.html#tags-operations-examples-cli-untag-resource>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To update a data catalog** | |
1 | ||
2 | The following ``update-data-catalog`` example updates the Lambda function and description of the ``cw_logs_catalog`` data catalog. :: | |
3 | ||
4 | aws athena update-data-catalog \ | |
5 | --name cw_logs_catalog \ | |
6 | --type LAMBDA \ | |
7 | --description "New CloudWatch Logs Catalog" \ | |
8 | --function=arn:aws:lambda:us-west-2:111122223333:function:new_cw_logs_lambda | |
9 | ||
10 | This command produces no output. To see the result, use ``aws athena get-data-catalog --name cw_logs_catalog``. | |
11 | ||
12 | For more information, see `Updating a Catalog: update-data-catalog <https://docs.aws.amazon.com/athena/latest/ug/datastores-hive-cli.html#datastores-hive-cli-updating-a-catalog>`__ in the *Amazon Athena User Guide*.⏎ |
0 | **To update a workgroup** | |
1 | ||
2 | The following ``update-work-group`` example disables the ``Data_Analyst_Group`` workgroup. Users cannot run or create queries in the disabled workgroup, but can still view metrics, data usage limit controls, workgroup settings, query history, and saved queries. :: | |
3 | ||
4 | aws athena update-work-group \ | |
5 | --work-group Data_Analyst_Group \ | |
6 | --state DISABLED | |
7 | ||
8 | This command produces no output. To verify the change in state, use ``aws athena get-work-group --work-group Data_Analyst_Group`` and check the ``State`` property in the output. | |
9 | ||
10 | For more information, see `Managing Workgroups <https://docs.aws.amazon.com/athena/latest/ug/workgroups-create-update-delete.html>`__ in the *Amazon Athena User Guide*.⏎ |
0 | 0 | **To retrieve multiple items from a table** |
1 | 1 | |
2 | The following ``batch-get-items`` example reads multiple items from the ``MusicCollection`` table using a batch of three ``GetItem`` requests. The command returns only the ``AlbumTitle`` attribute. :: | |
2 | The following ``batch-get-items`` example reads multiple items from the ``MusicCollection`` table using a batch of three ``GetItem`` requests, and requests the number of read capacity units consumed by the operation. The command returns only the ``AlbumTitle`` attribute. :: | |
3 | 3 | |
4 | 4 | aws dynamodb batch-get-item \ |
5 | --request-items file://request-items.json | |
5 | --request-items file://request-items.json \ | |
6 | --return-consumed-capacity TOTAL | |
6 | 7 | |
7 | 8 | Contents of ``request-items.json``:: |
8 | 9 | |
29 | 30 | Output:: |
30 | 31 | |
31 | 32 | { |
32 | "UnprocessedKeys": {}, | |
33 | 33 | "Responses": { |
34 | 34 | "MusicCollection": [ |
35 | 35 | { |
48 | 48 | } |
49 | 49 | } |
50 | 50 | ] |
51 | } | |
51 | }, | |
52 | "UnprocessedKeys": {}, | |
53 | "ConsumedCapacity": [ | |
54 | { | |
55 | "TableName": "MusicCollection", | |
56 | "CapacityUnits": 1.5 | |
57 | } | |
58 | ] | |
52 | 59 | } |
53 | 60 | |
54 | 61 | For more information, see `Batch Operations <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.BatchOperations>`__ in the *Amazon DynamoDB Developer Guide*. |
0 | 0 | **To add multiple items to a table** |
1 | 1 | |
2 | The following ``batch-write-item`` example adds three new items to the ``MusicCollection`` table using a batch of three ``PutItem`` requests. :: | |
2 | The following ``batch-write-item`` example adds three new items to the ``MusicCollection`` table using a batch of three ``PutItem`` requests. It also requests information about the number of write capacity units consumed by the operation and any item collections modified by the operation. :: | |
3 | 3 | |
4 | 4 | aws dynamodb batch-write-item \ |
5 | --request-items file://request-items.json | |
5 | --request-items file://request-items.json \ | |
6 | --return-consumed-capacity INDEXES \ | |
7 | --return-item-collection-metrics SIZE | |
6 | 8 | |
7 | 9 | Contents of ``request-items.json``:: |
8 | 10 | |
41 | 43 | Output:: |
42 | 44 | |
43 | 45 | { |
44 | "UnprocessedItems": {} | |
46 | "UnprocessedItems": {}, | |
47 | "ItemCollectionMetrics": { | |
48 | "MusicCollection": [ | |
49 | { | |
50 | "ItemCollectionKey": { | |
51 | "Artist": { | |
52 | "S": "No One You Know" | |
53 | } | |
54 | }, | |
55 | "SizeEstimateRangeGB": [ | |
56 | 0.0, | |
57 | 1.0 | |
58 | ] | |
59 | }, | |
60 | { | |
61 | "ItemCollectionKey": { | |
62 | "Artist": { | |
63 | "S": "Acme Band" | |
64 | } | |
65 | }, | |
66 | "SizeEstimateRangeGB": [ | |
67 | 0.0, | |
68 | 1.0 | |
69 | ] | |
70 | } | |
71 | ] | |
72 | }, | |
73 | "ConsumedCapacity": [ | |
74 | { | |
75 | "TableName": "MusicCollection", | |
76 | "CapacityUnits": 6.0, | |
77 | "Table": { | |
78 | "CapacityUnits": 3.0 | |
79 | }, | |
80 | "LocalSecondaryIndexes": { | |
81 | "AlbumTitleIndex": { | |
82 | "CapacityUnits": 3.0 | |
83 | } | |
84 | } | |
85 | } | |
86 | ] | |
45 | 87 | } |
46 | ||
88 | ||
47 | 89 | For more information, see `Batch Operations <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.BatchOperations>`__ in the *Amazon DynamoDB Developer Guide*. |
0 | **To create a table** | |
1 | ||
2 | The following ``create-table`` example uses the specified attributes and key schema to create a table named ``MusicCollection``. :: | |
0 | **Example 1: To create a table with tags** | |
1 | ||
2 | The following ``create-table`` example uses the specified attributes and key schema to create a table named ``MusicCollection``. This table uses provisioned throughput and is encrypted at rest using the default AWS owned CMK. The command also applies a tag to the table, with a key of ``Owner`` and a value of ``blueTeam``. :: | |
3 | 3 | |
4 | 4 | aws dynamodb create-table \ |
5 | 5 | --table-name MusicCollection \ |
6 | 6 | --attribute-definitions AttributeName=Artist,AttributeType=S AttributeName=SongTitle,AttributeType=S \ |
7 | 7 | --key-schema AttributeName=Artist,KeyType=HASH AttributeName=SongTitle,KeyType=RANGE \ |
8 | --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 | |
8 | --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 \ | |
9 | --tags Key=Owner,Value=blueTeam | |
9 | 10 | |
10 | 11 | Output:: |
11 | 12 | |
40 | 41 | } |
41 | 42 | ], |
42 | 43 | "ItemCount": 0, |
43 | "CreationDateTime": 1421866952.062 | |
44 | } | |
45 | } | |
46 | ||
47 | For more information, see `Basic Operations for Tables <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.Basics.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
44 | "CreationDateTime": "2020-05-26T16:04:41.627000-07:00", | |
45 | "TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection", | |
46 | "TableId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" | |
47 | } | |
48 | } | |
49 | ||
50 | For more information, see `Basic Operations for Tables <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.Basics.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
51 | ||
52 | **Example 2: To create a table in On-Demand Mode** | |
53 | ||
54 | The following example creates a table called ``MusicCollection`` using on-demand mode, rather than provisioned throughput mode. This is useful for tables with unpredictable workloads. :: | |
55 | ||
56 | aws dynamodb create-table \ | |
57 | --table-name MusicCollection \ | |
58 | --attribute-definitions AttributeName=Artist,AttributeType=S AttributeName=SongTitle,AttributeType=S \ | |
59 | --key-schema AttributeName=Artist,KeyType=HASH AttributeName=SongTitle,KeyType=RANGE \ | |
60 | --billing-mode PAY_PER_REQUEST | |
61 | ||
62 | Output:: | |
63 | ||
64 | { | |
65 | "TableDescription": { | |
66 | "AttributeDefinitions": [ | |
67 | { | |
68 | "AttributeName": "Artist", | |
69 | "AttributeType": "S" | |
70 | }, | |
71 | { | |
72 | "AttributeName": "SongTitle", | |
73 | "AttributeType": "S" | |
74 | } | |
75 | ], | |
76 | "TableName": "MusicCollection", | |
77 | "KeySchema": [ | |
78 | { | |
79 | "AttributeName": "Artist", | |
80 | "KeyType": "HASH" | |
81 | }, | |
82 | { | |
83 | "AttributeName": "SongTitle", | |
84 | "KeyType": "RANGE" | |
85 | } | |
86 | ], | |
87 | "TableStatus": "CREATING", | |
88 | "CreationDateTime": "2020-05-27T11:44:10.807000-07:00", | |
89 | "ProvisionedThroughput": { | |
90 | "NumberOfDecreasesToday": 0, | |
91 | "ReadCapacityUnits": 0, | |
92 | "WriteCapacityUnits": 0 | |
93 | }, | |
94 | "TableSizeBytes": 0, | |
95 | "ItemCount": 0, | |
96 | "TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection", | |
97 | "TableId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
98 | "BillingModeSummary": { | |
99 | "BillingMode": "PAY_PER_REQUEST" | |
100 | } | |
101 | } | |
102 | } | |
103 | ||
104 | For more information, see `Basic Operations for Tables <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.Basics.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
105 | ||
106 | **Example 3: To create a table and encrypt it with a Customer Managed CMK** | |
107 | ||
108 | The following example creates a table named ``MusicCollection`` and encrypts it using a customer managed CMK. :: | |
109 | ||
110 | aws dynamodb create-table \ | |
111 | --table-name MusicCollection \ | |
112 | --attribute-definitions AttributeName=Artist,AttributeType=S AttributeName=SongTitle,AttributeType=S \ | |
113 | --key-schema AttributeName=Artist,KeyType=HASH AttributeName=SongTitle,KeyType=RANGE \ | |
114 | --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 \ | |
115 | --sse-specification Enabled=true,SSEType=KMS,KMSMasterKeyId=abcd1234-abcd-1234-a123-ab1234a1b234 | |
116 | ||
117 | Output:: | |
118 | ||
119 | { | |
120 | "TableDescription": { | |
121 | "AttributeDefinitions": [ | |
122 | { | |
123 | "AttributeName": "Artist", | |
124 | "AttributeType": "S" | |
125 | }, | |
126 | { | |
127 | "AttributeName": "SongTitle", | |
128 | "AttributeType": "S" | |
129 | } | |
130 | ], | |
131 | "TableName": "MusicCollection", | |
132 | "KeySchema": [ | |
133 | { | |
134 | "AttributeName": "Artist", | |
135 | "KeyType": "HASH" | |
136 | }, | |
137 | { | |
138 | "AttributeName": "SongTitle", | |
139 | "KeyType": "RANGE" | |
140 | } | |
141 | ], | |
142 | "TableStatus": "CREATING", | |
143 | "CreationDateTime": "2020-05-27T11:12:16.431000-07:00", | |
144 | "ProvisionedThroughput": { | |
145 | "NumberOfDecreasesToday": 0, | |
146 | "ReadCapacityUnits": 5, | |
147 | "WriteCapacityUnits": 5 | |
148 | }, | |
149 | "TableSizeBytes": 0, | |
150 | "ItemCount": 0, | |
151 | "TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection", | |
152 | "TableId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
153 | "SSEDescription": { | |
154 | "Status": "ENABLED", | |
155 | "SSEType": "KMS", | |
156 | "KMSMasterKeyArn": "arn:aws:kms:us-west-2:123456789012:key/abcd1234-abcd-1234-a123-ab1234a1b234" | |
157 | } | |
158 | } | |
159 | } | |
160 | ||
161 | For more information, see `Basic Operations for Tables <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.Basics.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
162 | ||
163 | **Example 4: To create a table with a Local Secondary Index** | |
164 | ||
165 | The following example uses the specified attributes and key schema to create a table named ``MusicCollection`` with a Local Secondary Index named ``AlbumTitleIndex``. :: | |
166 | ||
167 | aws dynamodb create-table \ | |
168 | --table-name MusicCollection \ | |
169 | --attribute-definitions AttributeName=Artist,AttributeType=S AttributeName=SongTitle,AttributeType=S AttributeName=AlbumTitle,AttributeType=S \ | |
170 | --key-schema AttributeName=Artist,KeyType=HASH AttributeName=SongTitle,KeyType=RANGE \ | |
171 | --provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=5 \ | |
172 | --local-secondary-indexes \ | |
173 | "[ | |
174 | { | |
175 | \"IndexName\": \"AlbumTitleIndex\", | |
176 | \"KeySchema\": [ | |
177 | {\"AttributeName\": \"Artist\",\"KeyType\":\"HASH\"}, | |
178 | {\"AttributeName\": \"AlbumTitle\",\"KeyType\":\"RANGE\"} | |
179 | ], | |
180 | \"Projection\": { | |
181 | \"ProjectionType\": \"INCLUDE\", | |
182 | \"NonKeyAttributes\": [\"Genre\", \"Year\"] | |
183 | } | |
184 | } | |
185 | ]" | |
186 | ||
187 | Output:: | |
188 | ||
189 | { | |
190 | "TableDescription": { | |
191 | "AttributeDefinitions": [ | |
192 | { | |
193 | "AttributeName": "AlbumTitle", | |
194 | "AttributeType": "S" | |
195 | }, | |
196 | { | |
197 | "AttributeName": "Artist", | |
198 | "AttributeType": "S" | |
199 | }, | |
200 | { | |
201 | "AttributeName": "SongTitle", | |
202 | "AttributeType": "S" | |
203 | } | |
204 | ], | |
205 | "TableName": "MusicCollection", | |
206 | "KeySchema": [ | |
207 | { | |
208 | "AttributeName": "Artist", | |
209 | "KeyType": "HASH" | |
210 | }, | |
211 | { | |
212 | "AttributeName": "SongTitle", | |
213 | "KeyType": "RANGE" | |
214 | } | |
215 | ], | |
216 | "TableStatus": "CREATING", | |
217 | "CreationDateTime": "2020-05-26T15:59:49.473000-07:00", | |
218 | "ProvisionedThroughput": { | |
219 | "NumberOfDecreasesToday": 0, | |
220 | "ReadCapacityUnits": 10, | |
221 | "WriteCapacityUnits": 5 | |
222 | }, | |
223 | "TableSizeBytes": 0, | |
224 | "ItemCount": 0, | |
225 | "TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection", | |
226 | "TableId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
227 | "LocalSecondaryIndexes": [ | |
228 | { | |
229 | "IndexName": "AlbumTitleIndex", | |
230 | "KeySchema": [ | |
231 | { | |
232 | "AttributeName": "Artist", | |
233 | "KeyType": "HASH" | |
234 | }, | |
235 | { | |
236 | "AttributeName": "AlbumTitle", | |
237 | "KeyType": "RANGE" | |
238 | } | |
239 | ], | |
240 | "Projection": { | |
241 | "ProjectionType": "INCLUDE", | |
242 | "NonKeyAttributes": [ | |
243 | "Genre", | |
244 | "Year" | |
245 | ] | |
246 | }, | |
247 | "IndexSizeBytes": 0, | |
248 | "ItemCount": 0, | |
249 | "IndexArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection/index/AlbumTitleIndex" | |
250 | } | |
251 | ] | |
252 | } | |
253 | } | |
254 | ||
255 | For more information, see `Basic Operations for Tables <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.Basics.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
256 | ||
257 | **Example 5: To create a table with a Global Secondary Index** | |
258 | ||
259 | The following example creates a table named ``GameScores`` with a Global Secondary Index called ``GameTitleIndex``. The base table has a partition key of ``UserId`` and a sort key of ``GameTitle``, allowing you to find an individual user's best score for a specific game efficiently, whereas the GSI has a partition key of ``GameTitle`` and a sort key of ``TopScore``, allowing you to quickly find the overall highest score for a particular game. :: | |
260 | ||
261 | aws dynamodb create-table \ | |
262 | --table-name GameScores \ | |
263 | --attribute-definitions AttributeName=UserId,AttributeType=S \ | |
264 | AttributeName=GameTitle,AttributeType=S \ | |
265 | AttributeName=TopScore,AttributeType=N \ | |
266 | --key-schema AttributeName=UserId,KeyType=HASH \ | |
267 | AttributeName=GameTitle,KeyType=RANGE \ | |
268 | --provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=5 \ | |
269 | --global-secondary-indexes \ | |
270 | "[ | |
271 | { | |
272 | \"IndexName\": \"GameTitleIndex\", | |
273 | \"KeySchema\": [ | |
274 | {\"AttributeName\":\"GameTitle\",\"KeyType\":\"HASH\"}, | |
275 | {\"AttributeName\":\"TopScore\",\"KeyType\":\"RANGE\"} | |
276 | ], | |
277 | \"Projection\": { | |
278 | \"ProjectionType\":\"INCLUDE\", | |
279 | \"NonKeyAttributes\":[\"UserId\"] | |
280 | }, | |
281 | \"ProvisionedThroughput\": { | |
282 | \"ReadCapacityUnits\": 10, | |
283 | \"WriteCapacityUnits\": 5 | |
284 | } | |
285 | } | |
286 | ]" | |
287 | ||
288 | Output:: | |
289 | ||
290 | { | |
291 | "TableDescription": { | |
292 | "AttributeDefinitions": [ | |
293 | { | |
294 | "AttributeName": "GameTitle", | |
295 | "AttributeType": "S" | |
296 | }, | |
297 | { | |
298 | "AttributeName": "TopScore", | |
299 | "AttributeType": "N" | |
300 | }, | |
301 | { | |
302 | "AttributeName": "UserId", | |
303 | "AttributeType": "S" | |
304 | } | |
305 | ], | |
306 | "TableName": "GameScores", | |
307 | "KeySchema": [ | |
308 | { | |
309 | "AttributeName": "UserId", | |
310 | "KeyType": "HASH" | |
311 | }, | |
312 | { | |
313 | "AttributeName": "GameTitle", | |
314 | "KeyType": "RANGE" | |
315 | } | |
316 | ], | |
317 | "TableStatus": "CREATING", | |
318 | "CreationDateTime": "2020-05-26T17:28:15.602000-07:00", | |
319 | "ProvisionedThroughput": { | |
320 | "NumberOfDecreasesToday": 0, | |
321 | "ReadCapacityUnits": 10, | |
322 | "WriteCapacityUnits": 5 | |
323 | }, | |
324 | "TableSizeBytes": 0, | |
325 | "ItemCount": 0, | |
326 | "TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/GameScores", | |
327 | "TableId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
328 | "GlobalSecondaryIndexes": [ | |
329 | { | |
330 | "IndexName": "GameTitleIndex", | |
331 | "KeySchema": [ | |
332 | { | |
333 | "AttributeName": "GameTitle", | |
334 | "KeyType": "HASH" | |
335 | }, | |
336 | { | |
337 | "AttributeName": "TopScore", | |
338 | "KeyType": "RANGE" | |
339 | } | |
340 | ], | |
341 | "Projection": { | |
342 | "ProjectionType": "INCLUDE", | |
343 | "NonKeyAttributes": [ | |
344 | "UserId" | |
345 | ] | |
346 | }, | |
347 | "IndexStatus": "CREATING", | |
348 | "ProvisionedThroughput": { | |
349 | "NumberOfDecreasesToday": 0, | |
350 | "ReadCapacityUnits": 10, | |
351 | "WriteCapacityUnits": 5 | |
352 | }, | |
353 | "IndexSizeBytes": 0, | |
354 | "ItemCount": 0, | |
355 | "IndexArn": "arn:aws:dynamodb:us-west-2:123456789012:table/GameScores/index/GameTitleIndex" | |
356 | } | |
357 | ] | |
358 | } | |
359 | } | |
360 | ||
361 | For more information, see `Basic Operations for Tables <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.Basics.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
362 | ||
363 | ** Example 6: To create a table with Streams enabled** | |
364 | ||
365 | The following example creates a table called ``GameScores`` with DynamoDB Streams enabled. Both new and old images of each item will be written to the stream. | |
366 | ||
367 | aws dynamodb create-table \ | |
368 | --table-name GameScores \ | |
369 | --attribute-definitions AttributeName=UserId,AttributeType=S AttributeName=GameTitle,AttributeType=S \ | |
370 | --key-schema AttributeName=UserId,KeyType=HASH AttributeName=GameTitle,KeyType=RANGE \ | |
371 | --provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=5 \ | |
372 | --stream-specification StreamEnabled=TRUE,StreamViewType=NEW_AND_OLD_IMAGES | |
373 | ||
374 | Output:: | |
375 | ||
376 | { | |
377 | "TableDescription": { | |
378 | "AttributeDefinitions": [ | |
379 | { | |
380 | "AttributeName": "GameTitle", | |
381 | "AttributeType": "S" | |
382 | }, | |
383 | { | |
384 | "AttributeName": "UserId", | |
385 | "AttributeType": "S" | |
386 | } | |
387 | ], | |
388 | "TableName": "GameScores", | |
389 | "KeySchema": [ | |
390 | { | |
391 | "AttributeName": "UserId", | |
392 | "KeyType": "HASH" | |
393 | }, | |
394 | { | |
395 | "AttributeName": "GameTitle", | |
396 | "KeyType": "RANGE" | |
397 | } | |
398 | ], | |
399 | "TableStatus": "CREATING", | |
400 | "CreationDateTime": "2020-05-27T10:49:34.056000-07:00", | |
401 | "ProvisionedThroughput": { | |
402 | "NumberOfDecreasesToday": 0, | |
403 | "ReadCapacityUnits": 10, | |
404 | "WriteCapacityUnits": 5 | |
405 | }, | |
406 | "TableSizeBytes": 0, | |
407 | "ItemCount": 0, | |
408 | "TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/GameScores", | |
409 | "TableId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
410 | "StreamSpecification": { | |
411 | "StreamEnabled": true, | |
412 | "StreamViewType": "NEW_AND_OLD_IMAGES" | |
413 | }, | |
414 | "LatestStreamLabel": "2020-05-27T17:49:34.056", | |
415 | "LatestStreamArn": "arn:aws:dynamodb:us-west-2:123456789012:table/GameScores/stream/2020-05-27T17:49:34.056" | |
416 | } | |
417 | } | |
418 | ||
419 | For more information, see `Basic Operations for Tables <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.Basics.html>`__ in the *Amazon DynamoDB Developer Guide*. |
0 | **To delete an item** | |
0 | **Example 1: To delete an item** | |
1 | 1 | |
2 | The following ``delete-item`` example deletes an item from the ``MusicCollection`` table. :: | |
2 | The following ``delete-item`` example deletes an item from the ``MusicCollection`` table and requests details about the item that was deleted and the capacity used by the request. :: | |
3 | 3 | |
4 | 4 | aws dynamodb delete-item \ |
5 | 5 | --table-name MusicCollection \ |
6 | --key file://key.json | |
6 | --key file://key.json \ | |
7 | --return-values ALL_OLD \ | |
8 | --return-consumed-capacity TOTAL \ | |
9 | --return-item-collection-metrics SIZE | |
7 | 10 | |
8 | 11 | Contents of ``key.json``:: |
9 | 12 | |
15 | 18 | Output:: |
16 | 19 | |
17 | 20 | { |
21 | "Attributes": { | |
22 | "AlbumTitle": { | |
23 | "S": "Blue Sky Blues" | |
24 | }, | |
25 | "Artist": { | |
26 | "S": "No One You Know" | |
27 | }, | |
28 | "SongTitle": { | |
29 | "S": "Scared of My Shadow" | |
30 | } | |
31 | }, | |
18 | 32 | "ConsumedCapacity": { |
19 | "CapacityUnits": 1.0, | |
20 | "TableName": "MusicCollection" | |
33 | "TableName": "MusicCollection", | |
34 | "CapacityUnits": 2.0 | |
35 | }, | |
36 | "ItemCollectionMetrics": { | |
37 | "ItemCollectionKey": { | |
38 | "Artist": { | |
39 | "S": "No One You Know" | |
40 | } | |
41 | }, | |
42 | "SizeEstimateRangeGB": [ | |
43 | 0.0, | |
44 | 1.0 | |
45 | ] | |
21 | 46 | } |
22 | 47 | } |
23 | 48 | |
24 | 49 | For more information, see `Writing an Item <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.WritingData>`__ in the *Amazon DynamoDB Developer Guide*. |
50 | ||
51 | **Example 2: To delete an item conditionally** | |
52 | ||
53 | The following example deletes an item from the ``ProductCatalog`` table only if its ``ProductCategory`` is either ``Sporting Goods`` or ``Gardening Supplies`` and its price is between 500 and 600. It returns details about the item that was deleted. :: | |
54 | ||
55 | aws dynamodb delete-item \ | |
56 | --table-name ProductCatalog \ | |
57 | --key '{"Id":{"N":"456"}}' \ | |
58 | --condition-expression "(ProductCategory IN (:cat1, :cat2)) and (#P between :lo and :hi)" \ | |
59 | --expression-attribute-names file://names.json \ | |
60 | --expression-attribute-values file://values.json \ | |
61 | --return-values ALL_OLD | |
62 | ||
63 | Contents of ``names.json``:: | |
64 | ||
65 | { | |
66 | "#P": "Price" | |
67 | } | |
68 | ||
69 | Contents of ``values.json``:: | |
70 | ||
71 | { | |
72 | ":cat1": {"S": "Sporting Goods"}, | |
73 | ":cat2": {"S": "Gardening Supplies"}, | |
74 | ":lo": {"N": "500"}, | |
75 | ":hi": {"N": "600"} | |
76 | } | |
77 | ||
78 | Output:: | |
79 | ||
80 | { | |
81 | "Attributes": { | |
82 | "Id": { | |
83 | "N": "456" | |
84 | }, | |
85 | "Price": { | |
86 | "N": "550" | |
87 | }, | |
88 | "ProductCategory": { | |
89 | "S": "Sporting Goods" | |
90 | } | |
91 | } | |
92 | } | |
93 | ||
94 | For more information, see `Writing an Item <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.WritingData>`__ in the *Amazon DynamoDB Developer Guide*. |
0 | **To read an item in a table** | |
0 | **Example 1: To read an item in a table** | |
1 | 1 | |
2 | The following ``get-item`` example retrieves an item from the ``MusicCollection`` table. The table has a hash-and-range primary key (``Artist`` and ``SongTitle``), so you must specify both of these attributes. :: | |
2 | The following ``get-item`` example retrieves an item from the ``MusicCollection`` table. The table has a hash-and-range primary key (``Artist`` and ``SongTitle``), so you must specify both of these attributes. The command also requests information about the read capacity consumed by the operation. :: | |
3 | 3 | |
4 | 4 | aws dynamodb get-item \ |
5 | 5 | --table-name MusicCollection \ |
6 | --key file://key.json | |
6 | --key file://key.json \ | |
7 | --return-consumed-capacity TOTAL | |
7 | 8 | |
8 | 9 | Contents of ``key.json``:: |
9 | 10 | |
25 | 26 | "Artist": { |
26 | 27 | "S": "Acme Band" |
27 | 28 | } |
29 | }, | |
30 | "ConsumedCapacity": { | |
31 | "TableName": "MusicCollection", | |
32 | "CapacityUnits": 0.5 | |
28 | 33 | } |
29 | 34 | } |
30 | 35 | |
31 | 36 | For more information, see `Reading an Item <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.ReadingData>`__ in the *Amazon DynamoDB Developer Guide*. |
37 | ||
38 | **Example 2: To read an item using a consistent read** | |
39 | ||
40 | The following example retrieves an item from the ``MusicCollection`` table using strongly consistent reads. :: | |
41 | ||
42 | aws dynamodb get-item \ | |
43 | --table-name MusicCollection \ | |
44 | --key file://key.json \ | |
45 | --consistent-read \ | |
46 | --return-consumed-capacity TOTAL | |
47 | ||
48 | Contents of ``key.json``:: | |
49 | ||
50 | { | |
51 | "Artist": {"S": "Acme Band"}, | |
52 | "SongTitle": {"S": "Happy Day"} | |
53 | } | |
54 | ||
55 | Output:: | |
56 | ||
57 | { | |
58 | "Item": { | |
59 | "AlbumTitle": { | |
60 | "S": "Songs About Life" | |
61 | }, | |
62 | "SongTitle": { | |
63 | "S": "Happy Day" | |
64 | }, | |
65 | "Artist": { | |
66 | "S": "Acme Band" | |
67 | } | |
68 | }, | |
69 | "ConsumedCapacity": { | |
70 | "TableName": "MusicCollection", | |
71 | "CapacityUnits": 1.0 | |
72 | } | |
73 | } | |
74 | ||
75 | For more information, see `Reading an Item <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.ReadingData>`__ in the *Amazon DynamoDB Developer Guide*. | |
76 | ||
77 | **Example 3: To retrieve specific attributes of an item** | |
78 | ||
79 | The following example uses a projection expression to retrieve only three attributes of the desired item. :: | |
80 | ||
81 | aws dynamodb get-item \ | |
82 | --table-name ProductCatalog \ | |
83 | --key file://key.json \ | |
84 | --projection-expression "#D, #R, #P" \ | |
85 | --expression-attribute-names file://names.json | |
86 | ||
87 | Contents of ``key.json``:: | |
88 | ||
89 | { | |
90 | "Id": {"N": "102"} | |
91 | } | |
92 | ||
93 | Contents of ``names.json``:: | |
94 | ||
95 | { | |
96 | "#t": "Title", | |
97 | "#d": "Description", | |
98 | "#p": "Price" | |
99 | } | |
100 | ||
101 | Output:: | |
102 | ||
103 | { | |
104 | "Item": { | |
105 | "Price": { | |
106 | "N": "20" | |
107 | }, | |
108 | "Title": { | |
109 | "S": "Book 102 Title" | |
110 | }, | |
111 | "ProductCategory": { | |
112 | "S": "Book" | |
113 | } | |
114 | } | |
115 | } | |
116 | ||
117 | For more information, see `Reading an Item <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.ReadingData>`__ in the *Amazon DynamoDB Developer Guide*.⏎ |
0 | **To list existing DynamoDB backups** | |
0 | **Example 1: To list all existing DynamoDB backups** | |
1 | 1 | |
2 | 2 | The following ``list-backups`` example lists all of your existing backups. :: |
3 | 3 | |
9 | 9 | "BackupSummaries": [ |
10 | 10 | { |
11 | 11 | "TableName": "MusicCollection", |
12 | "TableId": "b0c04bcc-309b-4352-b2ae-9088af169fe2", | |
12 | "TableId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
13 | 13 | "TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection", |
14 | "BackupArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection/backup/01576616366715-b4e58d3a", | |
15 | "BackupName": "MusicCollectionBackup", | |
16 | "BackupCreationDateTime": 1576616366.715, | |
14 | "BackupArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection/backup/01234567890123-a1bcd234", | |
15 | "BackupName": "MusicCollectionBackup1", | |
16 | "BackupCreationDateTime": "2020-02-12T14:41:51.617000-08:00", | |
17 | 17 | "BackupStatus": "AVAILABLE", |
18 | 18 | "BackupType": "USER", |
19 | "BackupSizeBytes": 0 | |
19 | "BackupSizeBytes": 170 | |
20 | }, | |
21 | { | |
22 | "TableName": "MusicCollection", | |
23 | "TableId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
24 | "TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection", | |
25 | "BackupArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection/backup/01234567890123-b2abc345", | |
26 | "BackupName": "MusicCollectionBackup2", | |
27 | "BackupCreationDateTime": "2020-06-26T11:08:35.431000-07:00", | |
28 | "BackupStatus": "AVAILABLE", | |
29 | "BackupType": "USER", | |
30 | "BackupSizeBytes": 400 | |
20 | 31 | } |
21 | 32 | ] |
22 | 33 | } |
23 | 34 | |
24 | 35 | For more information, see `On-Demand Backup and Restore for DynamoDB <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/BackupRestore.html>`__ in the *Amazon DynamoDB Developer Guide*. |
36 | ||
37 | **Example 2: To list user-created backups in a specific time range** | |
38 | ||
39 | The following example lists only backups of the ``MusicCollection`` table that were created by the user (not those automatically created by DynamoDB) with a creation date between January 1, 2020 and March 1, 2020. :: | |
40 | ||
41 | aws dynamodb list-backups \ | |
42 | --table-name MusicCollection \ | |
43 | --time-range-lower-bound 1577836800 \ | |
44 | --time-range-upper-bound 1583020800 \ | |
45 | --backup-type USER | |
46 | ||
47 | Output:: | |
48 | ||
49 | { | |
50 | "BackupSummaries": [ | |
51 | { | |
52 | "TableName": "MusicCollection", | |
53 | "TableId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
54 | "TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection", | |
55 | "BackupArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection/backup/01234567890123-a1bcd234", | |
56 | "BackupName": "MusicCollectionBackup1", | |
57 | "BackupCreationDateTime": "2020-02-12T14:41:51.617000-08:00", | |
58 | "BackupStatus": "AVAILABLE", | |
59 | "BackupType": "USER", | |
60 | "BackupSizeBytes": 170 | |
61 | } | |
62 | ] | |
63 | } | |
64 | ||
65 | For more information, see `On-Demand Backup and Restore for DynamoDB <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/BackupRestore.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
66 | ||
67 | **Example 3: To limit page size** | |
68 | ||
69 | The following example returns a list of all existing backups, but retrieves only one item in each call, performing multiple calls if necessary to get the entire list. Limiting the page size is useful when running list commands on a large number of resources, which can result in a "timed out" error when using the default page size of 1000. :: | |
70 | ||
71 | aws dynamodb list-backups \ | |
72 | --page-size 1 | |
73 | ||
74 | Output:: | |
75 | ||
76 | { | |
77 | "BackupSummaries": [ | |
78 | { | |
79 | "TableName": "MusicCollection", | |
80 | "TableId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
81 | "TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection", | |
82 | "BackupArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection/backup/01234567890123-a1bcd234", | |
83 | "BackupName": "MusicCollectionBackup1", | |
84 | "BackupCreationDateTime": "2020-02-12T14:41:51.617000-08:00", | |
85 | "BackupStatus": "AVAILABLE", | |
86 | "BackupType": "USER", | |
87 | "BackupSizeBytes": 170 | |
88 | }, | |
89 | { | |
90 | "TableName": "MusicCollection", | |
91 | "TableId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
92 | "TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection", | |
93 | "BackupArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection/backup/01234567890123-b2abc345", | |
94 | "BackupName": "MusicCollectionBackup2", | |
95 | "BackupCreationDateTime": "2020-06-26T11:08:35.431000-07:00", | |
96 | "BackupStatus": "AVAILABLE", | |
97 | "BackupType": "USER", | |
98 | "BackupSizeBytes": 400 | |
99 | } | |
100 | ] | |
101 | } | |
102 | ||
103 | For more information, see `On-Demand Backup and Restore for DynamoDB <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/BackupRestore.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
104 | ||
105 | **Example 4: To limit the number of items returned** | |
106 | ||
107 | The following example limits the number of items returned to 1. The response includes a ``NextToken`` value with which to retrieve the next page of results. :: | |
108 | ||
109 | aws dynamodb list-backups \ | |
110 | --max-items 1 | |
111 | ||
112 | Output:: | |
113 | ||
114 | { | |
115 | "BackupSummaries": [ | |
116 | { | |
117 | "TableName": "MusicCollection", | |
118 | "TableId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
119 | "TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection", | |
120 | "BackupArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection/backup/01234567890123-a1bcd234", | |
121 | "BackupName": "MusicCollectionBackup1", | |
122 | "BackupCreationDateTime": "2020-02-12T14:41:51.617000-08:00", | |
123 | "BackupStatus": "AVAILABLE", | |
124 | "BackupType": "USER", | |
125 | "BackupSizeBytes": 170 | |
126 | } | |
127 | ], | |
128 | "NextToken": "abCDeFGhiJKlmnOPqrSTuvwxYZ1aBCdEFghijK7LM51nOpqRSTuv3WxY3ZabC5dEFGhI2Jk3LmnoPQ6RST9" | |
129 | } | |
130 | ||
131 | For more information, see `On-Demand Backup and Restore for DynamoDB <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/BackupRestore.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
132 | ||
133 | **Example 5: To retrieve the next page of results** | |
134 | ||
135 | The following command uses the ``NextToken`` value from a previous call to the ``list-backups`` command to retrieve another page of results. Since the response in this case does not include a ``NextToken`` value, we know that we have reached the end of the results. :: | |
136 | ||
137 | aws dynamodb list-backups \ | |
138 | --starting-token abCDeFGhiJKlmnOPqrSTuvwxYZ1aBCdEFghijK7LM51nOpqRSTuv3WxY3ZabC5dEFGhI2Jk3LmnoPQ6RST9 | |
139 | ||
140 | Output :: | |
141 | ||
142 | { | |
143 | "BackupSummaries": [ | |
144 | { | |
145 | "TableName": "MusicCollection", | |
146 | "TableId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", | |
147 | "TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection", | |
148 | "BackupArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection/backup/01234567890123-b2abc345", | |
149 | "BackupName": "MusicCollectionBackup2", | |
150 | "BackupCreationDateTime": "2020-06-26T11:08:35.431000-07:00", | |
151 | "BackupStatus": "AVAILABLE", | |
152 | "BackupType": "USER", | |
153 | "BackupSizeBytes": 400 | |
154 | } | |
155 | ] | |
156 | } | |
157 | ||
158 | For more information, see `On-Demand Backup and Restore for DynamoDB <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/BackupRestore.html>`__ in the *Amazon DynamoDB Developer Guide*.⏎ |
0 | **To list tables** | |
0 | **Example 1: To list tables** | |
1 | 1 | |
2 | 2 | The following ``list-tables`` example lists all of the tables associated with the current AWS account and Region. :: |
3 | 3 | |
7 | 7 | |
8 | 8 | { |
9 | 9 | "TableNames": [ |
10 | "Forum", | |
11 | "ProductCatalog", | |
12 | "Reply", | |
13 | "Thread", | |
10 | "Forum", | |
11 | "ProductCatalog", | |
12 | "Reply", | |
13 | "Thread" | |
14 | 14 | ] |
15 | 15 | } |
16 | 16 | |
17 | 17 | For more information, see `Listing Table Names <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.Basics.html#WorkingWithTables.Basics.ListTables>`__ in the *Amazon DynamoDB Developer Guide*. |
18 | ||
19 | **Example 2: To limit page size** | |
20 | ||
21 | The following example returns a list of all existing tables, but retrieves only one item in each call, performing multiple calls if necessary to get the entire list. Limiting the page size is useful when running list commands on a large number of resources, which can result in a "timed out" error when using the default page size of 1000. :: | |
22 | ||
23 | aws dynamodb list-tables \ | |
24 | --page-size 1 | |
25 | ||
26 | Output:: | |
27 | ||
28 | { | |
29 | "TableNames": [ | |
30 | "Forum", | |
31 | "ProductCatalog", | |
32 | "Reply", | |
33 | "Thread" | |
34 | ] | |
35 | } | |
36 | ||
37 | For more information, see `Listing Table Names <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.Basics.html#WorkingWithTables.Basics.ListTables>`__ in the *Amazon DynamoDB Developer Guide*. | |
38 | ||
39 | **Example 3: To limit the number of items returned** | |
40 | ||
41 | The following example limits the number of items returned to 2. The response includes a ``NextToken`` value with which to retrieve the next page of results. :: | |
42 | ||
43 | aws dynamodb list-tables \ | |
44 | --max-items 2 | |
45 | ||
46 | Output:: | |
47 | ||
48 | { | |
49 | "TableNames": [ | |
50 | "Forum", | |
51 | "ProductCatalog" | |
52 | ], | |
53 | "NextToken": "abCDeFGhiJKlmnOPqrSTuvwxYZ1aBCdEFghijK7LM51nOpqRSTuv3WxY3ZabC5dEFGhI2Jk3LmnoPQ6RST9" | |
54 | } | |
55 | ||
56 | For more information, see `Listing Table Names <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.Basics.html#WorkingWithTables.Basics.ListTables>`__ in the *Amazon DynamoDB Developer Guide*. | |
57 | ||
58 | **Example 4: To retrieve the next page of results** | |
59 | ||
60 | The following command uses the ``NextToken`` value from a previous call to the ``list-tables`` command to retrieve another page of results. Since the response in this case does not include a ``NextToken`` value, we know that we have reached the end of the results. :: | |
61 | ||
62 | aws dynamodb list-tables \ | |
63 | --starting-token abCDeFGhiJKlmnOPqrSTuvwxYZ1aBCdEFghijK7LM51nOpqRSTuv3WxY3ZabC5dEFGhI2Jk3LmnoPQ6RST9 | |
64 | ||
65 | Output:: | |
66 | ||
67 | { | |
68 | "TableNames": [ | |
69 | "Reply", | |
70 | "Thread" | |
71 | ] | |
72 | } | |
73 | ||
74 | For more information, see `Listing Table Names <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.Basics.html#WorkingWithTables.Basics.ListTables>`__ in the *Amazon DynamoDB Developer Guide*.⏎ |
0 | **To list tags of a DynamoDB resource** | |
0 | **Example 1: To list tags of a DynamoDB resource** | |
1 | 1 | |
2 | 2 | The following ``list-tags-of-resource`` example displays tags for the ``MusicCollection`` table. :: |
3 | 3 | |
11 | 11 | { |
12 | 12 | "Key": "Owner", |
13 | 13 | "Value": "blueTeam" |
14 | }, | |
15 | { | |
16 | "Key": "Environment", | |
17 | "Value": "Production" | |
14 | 18 | } |
15 | 19 | ] |
16 | 20 | } |
17 | 21 | |
18 | 22 | For more information, see `Tagging for DynamoDB <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tagging.html>`__ in the *Amazon DynamoDB Developer Guide*. |
23 | ||
24 | **Example 2: To limit the number of tags returned** | |
25 | ||
26 | The following example limits the number of tags returned to 1. The response includes a ``NextToken`` value with which to retrieve the next page of results. :: | |
27 | ||
28 | aws dynamodb list-tags-of-resource \ | |
29 | --resource-arn arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection \ | |
30 | --max-items 1 | |
31 | ||
32 | Output:: | |
33 | ||
34 | { | |
35 | "Tags": [ | |
36 | { | |
37 | "Key": "Owner", | |
38 | "Value": "blueTeam" | |
39 | } | |
40 | ], | |
41 | "NextToken": "abCDeFGhiJKlmnOPqrSTuvwxYZ1aBCdEFghijK7LM51nOpqRSTuv3WxY3ZabC5dEFGhI2Jk3LmnoPQ6RST9" | |
42 | } | |
43 | ||
44 | For more information, see `Tagging for DynamoDB <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tagging.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
45 | ||
46 | **Example 3: To retrieve the next page of results** | |
47 | ||
48 | The following command uses the ``NextToken`` value from a previous call to the ``list-tags-of-resource`` command to retrieve another page of results. Since the response in this case does not include a ``NextToken`` value, we know that we have reached the end of the results. :: | |
49 | ||
50 | aws dynamodb list-tags-of-resource \ | |
51 | --resource-arn arn:aws:dynamodb:us-west-2:123456789012:table/MusicCollection \ | |
52 | --starting-token abCDeFGhiJKlmnOPqrSTuvwxYZ1aBCdEFghijK7LM51nOpqRSTuv3WxY3ZabC5dEFGhI2Jk3LmnoPQ6RST9 | |
53 | ||
54 | Output:: | |
55 | ||
56 | { | |
57 | "Tags": [ | |
58 | { | |
59 | "Key": "Environment", | |
60 | "Value": "Production" | |
61 | } | |
62 | ] | |
63 | } | |
64 | ||
65 | For more information, see `Tagging for DynamoDB <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tagging.html>`__ in the *Amazon DynamoDB Developer Guide*.⏎ |
0 | **To query an item** | |
0 | **Example 1: To query a table** | |
1 | 1 | |
2 | 2 | The following ``query`` example queries items in the ``MusicCollection`` table. The table has a hash-and-range primary key (``Artist`` and ``SongTitle``), but this query only specifies the hash key value. It returns song titles by the artist named "No One You Know". :: |
3 | 3 | |
5 | 5 | --table-name MusicCollection \ |
6 | 6 | --projection-expression "SongTitle" \ |
7 | 7 | --key-condition-expression "Artist = :v1" \ |
8 | --expression-attribute-values file://expression-attributes.json \ | |
9 | --return-consumed-capacity TOTAL | |
10 | ||
11 | Contents of ``expression-attributes.json``:: | |
12 | ||
13 | { | |
14 | ":v1": {"S": "No One You Know"} | |
15 | } | |
16 | ||
17 | Output:: | |
18 | ||
19 | { | |
20 | "Items": [ | |
21 | { | |
22 | "SongTitle": { | |
23 | "S": "Call Me Today" | |
24 | }, | |
25 | "SongTitle": { | |
26 | "S": "Scared of My Shadow" | |
27 | } | |
28 | } | |
29 | ], | |
30 | "Count": 2, | |
31 | "ScannedCount": 2, | |
32 | "ConsumedCapacity": { | |
33 | "TableName": "MusicCollection", | |
34 | "CapacityUnits": 0.5 | |
35 | } | |
36 | } | |
37 | ||
38 | For more information, see `Working with Queries in DynamoDB <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
39 | ||
40 | **Example 2: To query a table using strongly consistent reads and traverse the index in descending order** | |
41 | ||
42 | The following example performs the same query as the first example, but returns results in reverse order and uses strongly consistent reads. :: | |
43 | ||
44 | aws dynamodb query \ | |
45 | --table-name MusicCollection \ | |
46 | --projection-expression "SongTitle" \ | |
47 | --key-condition-expression "Artist = :v1" \ | |
48 | --expression-attribute-values file://expression-attributes.json \ | |
49 | --consistent-read \ | |
50 | --no-scan-index-forward \ | |
51 | --return-consumed-capacity TOTAL | |
52 | ||
53 | Contents of ``expression-attributes.json``:: | |
54 | ||
55 | { | |
56 | ":v1": {"S": "No One You Know"} | |
57 | } | |
58 | ||
59 | Output:: | |
60 | ||
61 | { | |
62 | "Items": [ | |
63 | { | |
64 | "SongTitle": { | |
65 | "S": "Scared of My Shadow" | |
66 | } | |
67 | }, | |
68 | { | |
69 | "SongTitle": { | |
70 | "S": "Call Me Today" | |
71 | } | |
72 | } | |
73 | ], | |
74 | "Count": 2, | |
75 | "ScannedCount": 2, | |
76 | "ConsumedCapacity": { | |
77 | "TableName": "MusicCollection", | |
78 | "CapacityUnits": 1.0 | |
79 | } | |
80 | } | |
81 | ||
82 | For more information, see `Working with Queries in DynamoDB <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
83 | ||
84 | **Example 3: To filter out specific results** | |
85 | ||
86 | The following example queries the ``MusicCollection`` but excludes results with specific values in the ``AlbumTitle`` attribute. Note that this does not affect the ``ScannedCount`` or ``ConsumedCapacity``, because the filter is applied after the items have been read. :: | |
87 | ||
88 | aws dynamodb query \ | |
89 | --table-name MusicCollection \ | |
90 | --key-condition-expression "#n1 = :v1" \ | |
91 | --filter-expression "NOT (#n2 IN (:v2, :v3))" \ | |
92 | --expression-attribute-names file://names.json \ | |
93 | --expression-attribute-values file://values.json \ | |
94 | --return-consumed-capacity TOTAL | |
95 | ||
96 | Contents of ``values.json``:: | |
97 | ||
98 | { | |
99 | ":v1": {"S": "No One You Know"}, | |
100 | ":v2": {"S": "Blue Sky Blues"}, | |
101 | ":v3": {"S": "Greatest Hits"} | |
102 | } | |
103 | ||
104 | Contents of ``names.json``:: | |
105 | ||
106 | { | |
107 | "#n1": "Artist", | |
108 | "#n2": "AlbumTitle" | |
109 | } | |
110 | ||
111 | Output:: | |
112 | ||
113 | { | |
114 | "Items": [ | |
115 | { | |
116 | "AlbumTitle": { | |
117 | "S": "Somewhat Famous" | |
118 | }, | |
119 | "Artist": { | |
120 | "S": "No One You Know" | |
121 | }, | |
122 | "SongTitle": { | |
123 | "S": "Call Me Today" | |
124 | } | |
125 | } | |
126 | ], | |
127 | "Count": 1, | |
128 | "ScannedCount": 2, | |
129 | "ConsumedCapacity": { | |
130 | "TableName": "MusicCollection", | |
131 | "CapacityUnits": 0.5 | |
132 | } | |
133 | } | |
134 | ||
135 | For more information, see `Working with Queries in DynamoDB <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
136 | ||
137 | **Example 4: To retrieve only an item count** | |
138 | ||
139 | The following example retrieves a count of items matching the query, but does not retrieve any of the items themselves. :: | |
140 | ||
141 | aws dynamodb query \ | |
142 | --table-name MusicCollection \ | |
143 | --select COUNT \ | |
144 | --key-condition-expression "Artist = :v1" \ | |
8 | 145 | --expression-attribute-values file://expression-attributes.json |
9 | 146 | |
10 | 147 | Contents of ``expression-attributes.json``:: |
17 | 154 | |
18 | 155 | { |
19 | 156 | "Count": 2, |
20 | "Items": [ | |
21 | { | |
22 | "SongTitle": { | |
23 | "S": "Call Me Today" | |
157 | "ScannedCount": 2, | |
158 | "ConsumedCapacity": null | |
159 | } | |
160 | ||
161 | For more information, see `Working with Queries in DynamoDB <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
162 | ||
163 | **Example 5: To query an index** | |
164 | ||
165 | The following example queries the local secondary index ``AlbumTitleIndex``. The query returns all attributes from the base table that have been projected into the local secondary index. Note that when querying a local secondary index or global secondary index, you must also provide the name of the base table using the ``table-name`` parameter. | |
166 | ||
167 | aws dynamodb query \ | |
168 | --table-name MusicCollection \ | |
169 | --index-name AlbumTitleIndex \ | |
170 | --key-condition-expression "Artist = :v1" \ | |
171 | --expression-attribute-values file://expression-attributes.json \ | |
172 | --select ALL_PROJECTED_ATTRIBUTES \ | |
173 | --return-consumed-capacity INDEXES | |
174 | ||
175 | Contents of ``expression-attributes.json``:: | |
176 | ||
177 | { | |
178 | ":v1": {"S": "No One You Know"} | |
179 | } | |
180 | ||
181 | Output:: | |
182 | ||
183 | { | |
184 | "Items": [ | |
185 | { | |
186 | "AlbumTitle": { | |
187 | "S": "Blue Sky Blues" | |
188 | }, | |
189 | "Artist": { | |
190 | "S": "No One You Know" | |
24 | 191 | }, |
25 | 192 | "SongTitle": { |
26 | 193 | "S": "Scared of My Shadow" |
27 | 194 | } |
28 | } | |
29 | ], | |
30 | "ScannedCount": 2, | |
31 | "ConsumedCapacity": null | |
32 | } | |
33 | ||
34 | For more information, see `Working with Queries in DynamoDB <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
195 | }, | |
196 | { | |
197 | "AlbumTitle": { | |
198 | "S": "Somewhat Famous" | |
199 | }, | |
200 | "Artist": { | |
201 | "S": "No One You Know" | |
202 | }, | |
203 | "SongTitle": { | |
204 | "S": "Call Me Today" | |
205 | } | |
206 | } | |
207 | ], | |
208 | "Count": 2, | |
209 | "ScannedCount": 2, | |
210 | "ConsumedCapacity": { | |
211 | "TableName": "MusicCollection", | |
212 | "CapacityUnits": 0.5, | |
213 | "Table": { | |
214 | "CapacityUnits": 0.0 | |
215 | }, | |
216 | "LocalSecondaryIndexes": { | |
217 | "AlbumTitleIndex": { | |
218 | "CapacityUnits": 0.5 | |
219 | } | |
220 | } | |
221 | } | |
222 | } | |
223 | ||
224 | For more information, see `Working with Queries in DynamoDB <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html>`__ in the *Amazon DynamoDB Developer Guide*.⏎ |
2 | 2 | The following ``transact-get-items`` example retrieves multiple items atomically. :: |
3 | 3 | |
4 | 4 | aws dynamodb transact-get-items \ |
5 | --transact-items file://transact-items.json | |
5 | --transact-items file://transact-items.json \ | |
6 | --return-consumed-capacity TOTAL | |
6 | 7 | |
7 | 8 | Contents of ``transact-items.json``:: |
8 | 9 | |
30 | 31 | Output:: |
31 | 32 | |
32 | 33 | { |
34 | "ConsumedCapacity": [ | |
35 | { | |
36 | "TableName": "MusicCollection", | |
37 | "CapacityUnits": 4.0, | |
38 | "ReadCapacityUnits": 4.0 | |
39 | } | |
40 | ], | |
33 | 41 | "Responses": [ |
34 | 42 | { |
35 | 43 | "Item": { |
60 | 68 | ] |
61 | 69 | } |
62 | 70 | |
63 | For more information, see `Managing Complex Workflows with DynamoDB Transactions <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transactions.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
71 | For more information, see `Managing Complex Workflows with DynamoDB Transactions <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transactions.html>`__ in the *Amazon DynamoDB Developer Guide*.⏎ |
0 | **To write items atomically to one or more tables** | |
0 | **Example 1: To write items atomically to one or more tables** | |
1 | 1 | |
2 | 2 | The following ``transact-write-items`` example updates one item and deletes another. The operation fails if either operation fails, or if either item contains a ``Rating`` attribute. :: |
3 | 3 | |
4 | 4 | aws dynamodb transact-write-items \ |
5 | --transact-items file://transact-items.json | |
5 | --transact-items file://transact-items.json \ | |
6 | --return-consumed-capacity TOTAL \ | |
7 | --return-item-collection-metrics SIZE | |
8 | ||
9 | Contents of the ``transact-items.json`` file:: | |
10 | ||
11 | [ | |
12 | { | |
13 | "Update": { | |
14 | "Key": { | |
15 | "Artist": {"S": "Acme Band"}, | |
16 | "SongTitle": {"S": "Happy Day"} | |
17 | }, | |
18 | "UpdateExpression": "SET AlbumTitle = :newval", | |
19 | "ExpressionAttributeValues": { | |
20 | ":newval": {"S": "Updated Album Title"} | |
21 | }, | |
22 | "TableName": "MusicCollection", | |
23 | "ConditionExpression": "attribute_not_exists(Rating)" | |
24 | } | |
25 | }, | |
26 | { | |
27 | "Delete": { | |
28 | "Key": { | |
29 | "Artist": {"S": "No One You Know"}, | |
30 | "SongTitle": {"S": "Call Me Today"} | |
31 | }, | |
32 | "TableName": "MusicCollection", | |
33 | "ConditionExpression": "attribute_not_exists(Rating)" | |
34 | } | |
35 | } | |
36 | ] | |
37 | ||
38 | Output:: | |
39 | ||
40 | { | |
41 | "ConsumedCapacity": [ | |
42 | { | |
43 | "TableName": "MusicCollection", | |
44 | "CapacityUnits": 10.0, | |
45 | "WriteCapacityUnits": 10.0 | |
46 | } | |
47 | ], | |
48 | "ItemCollectionMetrics": { | |
49 | "MusicCollection": [ | |
50 | { | |
51 | "ItemCollectionKey": { | |
52 | "Artist": { | |
53 | "S": "No One You Know" | |
54 | } | |
55 | }, | |
56 | "SizeEstimateRangeGB": [ | |
57 | 0.0, | |
58 | 1.0 | |
59 | ] | |
60 | }, | |
61 | { | |
62 | "ItemCollectionKey": { | |
63 | "Artist": { | |
64 | "S": "Acme Band" | |
65 | } | |
66 | }, | |
67 | "SizeEstimateRangeGB": [ | |
68 | 0.0, | |
69 | 1.0 | |
70 | ] | |
71 | } | |
72 | ] | |
73 | } | |
74 | } | |
75 | ||
76 | For more information, see `Managing Complex Workflows with DynamoDB Transactions <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transactions.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
77 | ||
78 | **Example 2: To write items atomically using a client request token** | |
79 | ||
80 | The following command uses a client request token to make the call to ``transact-write-items`` idempotent, meaning that multiple calls have the same effect as one single call. :: | |
81 | ||
82 | aws dynamodb transact-write-items \ | |
83 | --transact-items file://transact-items.json \ | |
84 | --client-request-token abc123 | |
6 | 85 | |
7 | 86 | Contents of the ``transact-items.json`` file:: |
8 | 87 | |
35 | 114 | |
36 | 115 | This command produces no output. |
37 | 116 | |
38 | For more information, see `Managing Complex Workflows with DynamoDB Transactions <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transactions.html>`__ in the *Amazon DynamoDB Developer Guide*. | |
117 | For more information, see `Managing Complex Workflows with DynamoDB Transactions <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transactions.html>`__ in the *Amazon DynamoDB Developer Guide*.⏎ |
0 | **To create a global replication group** | |
1 | ||
2 | The following ``create-global-replication-group`` example creates a new global replication group. :: | |
3 | ||
4 | aws elasticache create-global-replication-group \ | |
5 | --global-replication-group-id-suffix my-global-replication-group \ | |
6 | --primary-replication-group-id my-primary-cluster | |
7 | ||
8 | Output:: | |
9 | ||
10 | { | |
11 | "CacheSubnetGroup": { | |
12 | "CacheSubnetGroupName": "my-global-replication-group", | |
13 | "CacheSubnetGroupDescription": "my subnet group", | |
14 | "VpcId": "vpc-xxxxxcdb", | |
15 | "Subnets": [ | |
16 | { | |
17 | "SubnetIdentifier": "subnet-xxxxexxf", | |
18 | "SubnetAvailabilityZone": { | |
19 | "Name": "us-west-2d" | |
20 | } | |
21 | } | |
22 | ] | |
23 | } | |
24 | } | |
25 | ||
26 | For more information, see `Replication Across AWS Regions Using Global Datastore <https://docs.amazonaws.cn/en_us/AmazonElastiCache/latest/red-ug/Redis-Global-Datastore.html>`__ in the *Elasticache User Guide*. |
0 | **To decrease the number of node groups in a global replication group** | |
1 | ||
2 | The following ``decrease-node-groups-in-global-replication-group`` decreases the node group count using the Redis engine. :: | |
3 | ||
4 | aws elasticache decrease-node-groups-in-global-replication-group \ | |
5 | --global-replication-group-id sgaui-test \ | |
6 | --node-group-count 1 \ | |
7 | --apply-immediately \ | |
8 | --global-node-groups-to-retain sgaui-test-0003 | |
9 | ||
10 | Output:: | |
11 | ||
12 | { | |
13 | "GlobalReplicationGroup": | |
14 | { | |
15 | "GlobalReplicationGroupId": "sgaui-test", | |
16 | "GlobalReplicationGroupDescription": "test", | |
17 | "Status": "modifying", | |
18 | "CacheNodeType": "cache.r5.large", | |
19 | "Engine": "redis", | |
20 | "EngineVersion": "5.0.6", | |
21 | "Members": [ | |
22 | { | |
23 | "ReplicationGroupId": "test-2", | |
24 | "ReplicationGroupRegion": "us-east-1", | |
25 | "Role": "SECONDARY", | |
26 | "AutomaticFailover": "enabled", | |
27 | "Status": "associated" | |
28 | }, | |
29 | { | |
30 | "ReplicationGroupId": "test-1", | |
31 | "ReplicationGroupRegion": "us-west-2", | |
32 | "Role": "PRIMARY", | |
33 | "AutomaticFailover": "enabled", | |
34 | "Status": "associated" | |
35 | } | |
36 | ], | |
37 | "ClusterEnabled": true, | |
38 | "GlobalNodeGroups": [ | |
39 | { | |
40 | "GlobalNodeGroupId": "sgaui-test-0001", | |
41 | "Slots": "0-449,1816-5461" | |
42 | }, | |
43 | { | |
44 | "GlobalNodeGroupId": "sgaui-test-0002", | |
45 | "Slots": "6827-10922" | |
46 | }, | |
47 | { | |
48 | "GlobalNodeGroupId": "sgaui-test-0003", | |
49 | "Slots": "10923-14052,15418-16383" | |
50 | }, | |
51 | { | |
52 | "GlobalNodeGroupId": "sgaui-test-0004", | |
53 | "Slots": "450-1815,5462-6826,14053-15417" | |
54 | } | |
55 | ], | |
56 | "AuthTokenEnabled": false, | |
57 | "TransitEncryptionEnabled": false, | |
58 | "AtRestEncryptionEnabled": false | |
59 | } | |
60 | } | |
61 | ||
62 | For more information, see `Replication Across AWS Regions Using Global Datastore <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Redis-Global-Datastore.html>`__ in the *Elasticache User Guide*.⏎ |
0 | **To delete a global replication group** | |
1 | ||
2 | The following ``delete-global-replication-group`` example deletes a new global replication group. :: | |
3 | ||
4 | aws elasticache delete-global-replication-group \ | |
5 | --global-replication-group-id my-global-replication-group \ | |
6 | --retain-primary-replication-group | |
7 | ||
8 | Output:: | |
9 | ||
10 | { | |
11 | "GlobalReplicationGroup": { | |
12 | "GlobalReplicationGroupId": "sgaui-my-grg", | |
13 | "GlobalReplicationGroupDescription": "my-grg", | |
14 | "Status": "deleting", | |
15 | "CacheNodeType": "cache.r5.large", | |
16 | "Engine": "redis", | |
17 | "EngineVersion": "5.0.6", | |
18 | "Members": [ | |
19 | { | |
20 | "ReplicationGroupId": "my-cluster-grg", | |
21 | "ReplicationGroupRegion": "us-west-2", | |
22 | "Role": "PRIMARY", | |
23 | "AutomaticFailover": "enabled", | |
24 | "Status": "associated" | |
25 | } | |
26 | ], | |
27 | "ClusterEnabled": false, | |
28 | "AuthTokenEnabled": false, | |
29 | "TransitEncryptionEnabled": false, | |
30 | "AtRestEncryptionEnabled": false | |
31 | } | |
32 | } | |
33 | ||
34 | For more information, see `Replication Across AWS Regions Using Global Datastore <https://docs.amazonaws.cn/en_us/AmazonElastiCache/latest/red-ug/Redis-Global-Datastore.html>`__ in the *Elasticache User Guide*. |
0 | **To delete a snapshot** | |
1 | ||
2 | The following ``delete-snapshot`` example deleted a snapshot using the Redis engine. :: | |
3 | ||
4 | aws elasticache delete-snapshot \ | |
5 | --snapshot-name mysnapshot | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "Snapshot": { | |
11 | "SnapshotName": "my-cluster-snapshot", | |
12 | "ReplicationGroupId": "mycluster", | |
13 | "ReplicationGroupDescription": "mycluster", | |
14 | "SnapshotStatus": "deleting", | |
15 | "SnapshotSource": "manual", | |
16 | "CacheNodeType": "cache.r5.xlarge", | |
17 | "Engine": "redis", | |
18 | "EngineVersion": "5.0.5", | |
19 | "PreferredMaintenanceWindow": "thu:12:00-thu:13:00", | |
20 | "TopicArn": "arn:aws:sns:us-west-2:xxxxxxxxxxxxx152:My_Topic", | |
21 | "Port": 6379, | |
22 | "CacheParameterGroupName": "default.redis5.0.cluster.on", | |
23 | "CacheSubnetGroupName": "default", | |
24 | "VpcId": "vpc-a3e97cdb", | |
25 | "AutoMinorVersionUpgrade": true, | |
26 | "SnapshotRetentionLimit": 1, | |
27 | "SnapshotWindow": "13:00-14:00", | |
28 | "NumNodeGroups": 4, | |
29 | "AutomaticFailover": "enabled", | |
30 | "NodeSnapshots": [ | |
31 | { | |
32 | "CacheClusterId": "mycluster-0002-003", | |
33 | "NodeGroupId": "0002", | |
34 | "CacheNodeId": "0001", | |
35 | "CacheSize": "6 MB", | |
36 | "CacheNodeCreateTime": "2020-06-18T00:05:44.719000+00:00", | |
37 | "SnapshotCreateTime": "2020-06-25T20:34:30+00:00" | |
38 | }, | |
39 | { | |
40 | "CacheClusterId": "mycluster-0003-003", | |
41 | "NodeGroupId": "0003", | |
42 | "CacheNodeId": "0001", | |
43 | "CacheSize": "6 MB", | |
44 | "CacheNodeCreateTime": "2019-12-05T19:13:15.912000+00:00", | |
45 | "SnapshotCreateTime": "2020-06-25T20:34:30+00:00" | |
46 | }, | |
47 | { | |
48 | "CacheClusterId": "mycluster-0004-002", | |
49 | "NodeGroupId": "0004", | |
50 | "CacheNodeId": "0001", | |
51 | "CacheSize": "6 MB", | |
52 | "CacheNodeCreateTime": "2019-12-09T19:44:34.324000+00:00", | |
53 | "SnapshotCreateTime": "2020-06-25T20:34:30+00:00" | |
54 | }, | |
55 | { | |
56 | "CacheClusterId": "mycluster-0005-003", | |
57 | "NodeGroupId": "0005", | |
58 | "CacheNodeId": "0001", | |
59 | "CacheSize": "6 MB", | |
60 | "CacheNodeCreateTime": "2020-06-18T00:05:44.775000+00:00", | |
61 | "SnapshotCreateTime": "2020-06-25T20:34:30+00:00" | |
62 | } | |
63 | ] | |
64 | } | |
65 | } | |
66 | ||
67 | For more information, see `Backup and Restore for ElastiCache for Redis <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups.html>`__ in the *Elasticache User Guide*.⏎ |
0 | **To describe cache subnet groups** | |
1 | ||
2 | The following ``describe-cache-subnet-groups`` example returns a list of subnet groups. :: | |
3 | ||
4 | aws elasticache describe-cache-subnet-groups | |
5 | ||
6 | Output:: | |
7 | ||
8 | { | |
9 | "CacheSubnetGroups": [ | |
10 | { | |
11 | "CacheSubnetGroupName": "default", | |
12 | "CacheSubnetGroupDescription": "Default CacheSubnetGroup", | |
13 | "VpcId": "vpc-a3e97cdb", | |
14 | "Subnets": [ | |
15 | { | |
16 | "SubnetIdentifier": "subnet-8d4bacf5", | |
17 | "SubnetAvailabilityZone": { | |
18 | "Name": "us-west-2b" | |
19 | } | |
20 | }, | |
21 | { | |
22 | "SubnetIdentifier": "subnet-dde21380", | |
23 | "SubnetAvailabilityZone": { | |
24 | "Name": "us-west-2c" | |
25 | } | |
26 | }, | |
27 | { | |
28 | "SubnetIdentifier": "subnet-6485ec4f", | |
29 | "SubnetAvailabilityZone": { | |
30 | "Name": "us-west-2d" | |
31 | } | |
32 | }, | |
33 | { | |
34 | "SubnetIdentifier": "subnet-b4ebebff", | |
35 | "SubnetAvailabilityZone": { | |
36 | "Name": "us-west-2a" | |
37 | } | |
38 | } | |
39 | ] | |
40 | }, | |
41 | { | |
42 | "CacheSubnetGroupName": "kxkxk", | |
43 | "CacheSubnetGroupDescription": "mygroup", | |
44 | "VpcId": "vpc-a3e97cdb", | |
45 | "Subnets": [ | |
46 | { | |
47 | "SubnetIdentifier": "subnet-b4ebebff", | |
48 | "SubnetAvailabilityZone": { | |
49 | "Name": "us-west-2a" | |
50 | } | |
51 | } | |
52 | ] | |
53 | }, | |
54 | { | |
55 | "CacheSubnetGroupName": "test", | |
56 | "CacheSubnetGroupDescription": "test", | |
57 | "VpcId": "vpc-a3e97cdb", | |
58 | "Subnets": [ | |
59 | { | |
60 | "SubnetIdentifier": "subnet-b4ebebff", | |
61 | "SubnetAvailabilityZone": { | |
62 | "Name": "us-west-2a" | |
63 | } | |
64 | } | |
65 | ] | |
66 | } | |
67 | ] | |
68 | } | |
69 | ||
70 | For more information, see `Subnets and Subnet Groups <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/SubnetGroups.html>`__ in the *Elasticache User Guide* or `Subnets and Subnet Groups <https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/SubnetGroups.html>`__ in the *ElastiCache for Memcached User Guide*.⏎ |
4 | 4 | aws elasticache describe-events \ |
5 | 5 | -- source-identifier test-cluster \ |
6 | 6 | --source-type replication-group |
7 | ||
8 | 7 | |
9 | 8 | Output:: |
10 | 9 |
0 | **To describe a global replication groups** | |
0 | **To describe global replication groups** | |
1 | 1 | |
2 | The following ``describe-global-replication-groups`` example returns details of a Global datastore :: | |
2 | The following ``describe-global-replication-groups`` example returns details of a Global datastore. :: | |
3 | 3 | |
4 | 4 | aws elasticache describe-global-replication-groups \ |
5 | --global-replication-group-id my-grg | |
5 | --global-replication-group-id my-grg | |
6 | 6 | |
7 | 7 | Output:: |
8 | 8 |
0 | **To increase the number of node groups in a global replication group** | |
1 | ||
2 | The following ``increase-node-groups-in-global-replication-group`` increases the node group count using the Redis engine. :: | |
3 | ||
4 | aws elasticache increase-node-groups-in-global-replication-group \ | |
5 | --global-replication-group-id sgaui-pat-test-4 \ | |
6 | --node-group-count 6 \ | |
7 | --apply-immediately | |
8 | ||
9 | Output:: | |
10 | ||
11 | { | |
12 | "GlobalReplicationGroup": { | |
13 | "GlobalReplicationGroupId": "sgaui-test-4", | |
14 | "GlobalReplicationGroupDescription": "test-4", | |
15 | "Status": "modifying", | |
16 | "CacheNodeType": "cache.r5.large", | |
17 | "Engine": "redis", | |
18 | "EngineVersion": "5.0.6", | |
19 | "Members": [ | |
20 | { | |
21 | "ReplicationGroupId": "my-cluster-b", | |
22 | "ReplicationGroupRegion": "us-east-1", | |
23 | "Role": "SECONDARY", | |
24 | "AutomaticFailover": "enabled", | |
25 | "Status": "associated" | |
26 | }, | |
27 | { | |
28 | "ReplicationGroupId": "my-cluster-a", | |
29 | "ReplicationGroupRegion": "us-west-2", | |
30 | "Role": "PRIMARY", | |
31 | "AutomaticFailover": "enabled", | |
32 | "Status": "associated" | |
33 | } | |
34 | ], | |
35 | "ClusterEnabled": true, | |
36 | "GlobalNodeGroups": [ | |
37 | { | |
38 | "GlobalNodeGroupId": "sgaui-test-4-0001", | |
39 | "Slots": "0-234,2420-5461" | |
40 | }, | |
41 | { | |
42 | "GlobalNodeGroupId": "sgaui-test-4-0002", | |
43 | "Slots": "5462-5904,6997-9830" | |
44 | }, | |
45 | { | |
46 | "GlobalNodeGroupId": "sgaui-test-4-0003", | |
47 | "Slots": "10923-11190,13375-16383" | |
48 | }, | |
49 | { | |
50 | "GlobalNodeGroupId": "sgaui-test-4-0004", | |
51 | "Slots": "235-2419,5905-6996" | |
52 | }, | |
53 | { | |
54 | "GlobalNodeGroupId": "sgaui-test-4-0005", | |
55 | "Slots": "9831-10922,11191-13374" | |
56 | } | |
57 | ], | |
58 | "AuthTokenEnabled": false, | |
59 | "TransitEncryptionEnabled": false, | |
60 | "AtRestEncryptionEnabled": false | |
61 | } | |
62 | } | |
63 | ||
64 | For more information, see `Replication Across AWS Regions Using Global Datastore <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Redis-Global-Datastore.html>`__ in the *Elasticache User Guide*.⏎ |
0 | **To list events** | |
1 | ||
2 | The following ``list-tags-for-resource`` example lists the tags for a cache cluster. :: | |
3 | ||
4 | aws elasticache list-tags-for-resource \ | |
5 | --resource-name "arn:aws:elasticache:us-east-1:123456789012:cluster:my-cluster" | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "TagList": [ | |
11 | { | |
12 | "Key": "Project", | |
13 | "Value": "querySpeedUp" | |
14 | }, | |
15 | { | |
16 | "Key": "Environment", | |
17 | "Value": "PROD" | |
18 | } | |
19 | ] | |
20 | } | |
21 | ||
22 | For more information, see `Listing Tags Using the AWS CLI < https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Tagging.Managing.CLI.html#Tagging.Managing.CLI.List>`__ in the *Amazon ElastiCache for Redis User Guide*. |
0 | **To modify a global replication group** | |
1 | ||
2 | The following ``modify-global-replication-group`` modifies the properties of a global replication group, in this case disabling automatic failover, using the Redis engine. :: | |
3 | ||
4 | aws elasticache modify-global-replication-group \ | |
5 | --global-replication-group-id sgaui-pat-group \ | |
6 | --apply-immediately \ | |
7 | --no-automatic-failover-enabled | |
8 | ||
9 | Output :: | |
10 | ||
11 | { | |
12 | "GlobalReplicationGroup": { | |
13 | "GlobalReplicationGroupId": "sgaui-test-group", | |
14 | "GlobalReplicationGroupDescription": " ", | |
15 | "Status": "modifying", | |
16 | "CacheNodeType": "cache.r5.large", | |
17 | "Engine": "redis", | |
18 | "EngineVersion": "5.0.6", | |
19 | "ClusterEnabled": false, | |
20 | "AuthTokenEnabled": false, | |
21 | "TransitEncryptionEnabled": false, | |
22 | "AtRestEncryptionEnabled": false | |
23 | } | |
24 | } | |
25 | ||
26 | For more information, see `Replication Across AWS Regions Using Global Datastore <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Redis-Global-Datastore.html>`__ in the *Elasticache User Guide*.⏎ |
0 | **To modify a replication group shard configuration** | |
1 | ||
2 | The following ``modify-replication-group-shard-configuration`` decreases the node group count using the Redis engine. :: | |
3 | ||
4 | aws elasticache modify-replication-group-shard-configuration \ | |
5 | --replication-group-id mycluster \ | |
6 | --node-group-count 3 \ | |
7 | --apply-immediately \ | |
8 | --node-groups-to-remove 0002 | |
9 | ||
10 | Output :: | |
11 | ||
12 | { | |
13 | "ReplicationGroup": { | |
14 | "ReplicationGroupId": "mycluster", | |
15 | "Description": "mycluster", | |
16 | "GlobalReplicationGroupInfo": {}, | |
17 | "Status": "modifying", | |
18 | "PendingModifiedValues": {}, | |
19 | "MemberClusters": [ | |
20 | "mycluster-0002-001", | |
21 | "mycluster-0002-002", | |
22 | "mycluster-0002-003", | |
23 | "mycluster-0003-001", | |
24 | "mycluster-0003-002", | |
25 | "mycluster-0003-003", | |
26 | "mycluster-0003-004", | |
27 | "mycluster-0004-001", | |
28 | "mycluster-0004-002", | |
29 | "mycluster-0004-003", | |
30 | "mycluster-0005-001", | |
31 | "mycluster-0005-002", | |
32 | "mycluster-0005-003" | |
33 | ], | |
34 | "NodeGroups": [ | |
35 | { | |
36 | "NodeGroupId": "0002", | |
37 | "Status": "modifying", | |
38 | "Slots": "894-1767,3134-4443,5149-5461,6827-7332,12570-13662", | |
39 | "NodeGroupMembers": [ | |
40 | { | |
41 | "CacheClusterId": "mycluster-0002-001", | |
42 | "CacheNodeId": "0001", | |
43 | "PreferredAvailabilityZone": "us-west-2c" | |
44 | }, | |
45 | { | |
46 | "CacheClusterId": "mycluster-0002-002", | |
47 | "CacheNodeId": "0001", | |
48 | "PreferredAvailabilityZone": "us-west-2a" | |
49 | }, | |
50 | { | |
51 | "CacheClusterId": "mycluster-0002-003", | |
52 | "CacheNodeId": "0001", | |
53 | "PreferredAvailabilityZone": "us-west-2b" | |
54 | } | |
55 | ] | |
56 | }, | |
57 | { | |
58 | "NodeGroupId": "0003", | |
59 | "Status": "modifying", | |
60 | "Slots": "0-324,5462-5692,6784-6826,7698-8191,10923-11075,12441-12569,13663-16383", | |
61 | "NodeGroupMembers": [ | |
62 | { | |
63 | "CacheClusterId": "mycluster-0003-001", | |
64 | "CacheNodeId": "0001", | |
65 | "PreferredAvailabilityZone": "us-west-2c" | |
66 | }, | |
67 | { | |
68 | "CacheClusterId": "mycluster-0003-002", | |
69 | "CacheNodeId": "0001", | |
70 | "PreferredAvailabilityZone": "us-west-2b" | |
71 | }, | |
72 | { | |
73 | "CacheClusterId": "mycluster-0003-003", | |
74 | "CacheNodeId": "0001", | |
75 | "PreferredAvailabilityZone": "us-west-2a" | |
76 | }, | |
77 | { | |
78 | "CacheClusterId": "mycluster-0003-004", | |
79 | "CacheNodeId": "0001", | |
80 | "PreferredAvailabilityZone": "us-west-2c" | |
81 | } | |
82 | ] | |
83 | }, | |
84 | { | |
85 | "NodeGroupId": "0004", | |
86 | "Status": "modifying", | |
87 | "Slots": "325-336,4706-5148,7333-7697,9012-10922,11076-12440", | |
88 | "NodeGroupMembers": [ | |
89 | { | |
90 | "CacheClusterId": "mycluster-0004-001", | |
91 | "CacheNodeId": "0001", | |
92 | "PreferredAvailabilityZone": "us-west-2b" | |
93 | }, | |
94 | { | |
95 | "CacheClusterId": "mycluster-0004-002", | |
96 | "CacheNodeId": "0001", | |
97 | "PreferredAvailabilityZone": "us-west-2a" | |
98 | }, | |
99 | { | |
100 | "CacheClusterId": "mycluster-0004-003", | |
101 | "CacheNodeId": "0001", | |
102 | "PreferredAvailabilityZone": "us-west-2c" | |
103 | } | |
104 | ] | |
105 | }, | |
106 | { | |
107 | "NodeGroupId": "0005", | |
108 | "Status": "modifying", | |
109 | "Slots": "337-893,1768-3133,4444-4705,5693-6783,8192-9011", | |
110 | "NodeGroupMembers": [ | |
111 | { | |
112 | "CacheClusterId": "mycluster-0005-001", | |
113 | "CacheNodeId": "0001", | |
114 | "PreferredAvailabilityZone": "us-west-2a" | |
115 | }, | |
116 | { | |
117 | "CacheClusterId": "mycluster-0005-002", | |
118 | "CacheNodeId": "0001", | |
119 | "PreferredAvailabilityZone": "us-west-2c" | |
120 | }, | |
121 | { | |
122 | "CacheClusterId": "mycluster-0005-003", | |
123 | "CacheNodeId": "0001", | |
124 | "PreferredAvailabilityZone": "us-west-2b" | |
125 | } | |
126 | ] | |
127 | } | |
128 | ], | |
129 | "AutomaticFailover": "enabled", | |
130 | "MultiAZ": "enabled", | |
131 | "ConfigurationEndpoint": { | |
132 | "Address": "mycluster.g2xbih.clustercfg.usw2.cache.amazonaws.com", | |
133 | "Port": 6379 | |
134 | }, | |
135 | "SnapshotRetentionLimit": 1, | |
136 | "SnapshotWindow": "13:00-14:00", | |
137 | "ClusterEnabled": true, | |
138 | "CacheNodeType": "cache.r5.xlarge", | |
139 | "TransitEncryptionEnabled": false, | |
140 | "AtRestEncryptionEnabled": false | |
141 | } | |
142 | } | |
143 | ||
144 | For more information, see `Scaling ElastiCache for Redis Clusters <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Scaling.html>`__ in the *Elasticache User Guide*.⏎ |
0 | 0 | **To modify a replication group** |
1 | 1 | |
2 | The following ``modify-replication-group`` example modifies the settings for the specified replication group. | |
3 | For Redis (cluster mode enabled) clusters, this operation cannot be used to change a cluster's node type or engine version. :: | |
2 | The following ``modify-replication-group`` disables Multi-AZ using the Redis engine. :: | |
4 | 3 | |
5 | aws elasticache modify-replication-group / | |
6 | --replication-group-id "my cluster" / | |
7 | --replication-group-description "my cluster" / | |
8 | --preferred-maintenance-window sun:23:00-mon:01:30 / | |
9 | --notification-topic-arn arn:aws:sns:us-west-2:xxxxxxxxxxxxxx52:My_Topic | |
4 | aws elasticache modify-replication-group \ | |
5 | --replication-group-id test-cluster \ | |
6 | --no-multi-az-enabled \ | |
7 | --apply-immediately | |
10 | 8 | |
11 | Output:: | |
9 | Output :: | |
12 | 10 | |
13 | 11 | { |
14 | 12 | "ReplicationGroup": { |
15 | "ReplicationGroupId": "mycluster", | |
16 | "Description": "mycluster", | |
13 | "ReplicationGroupId": "test-cluster", | |
14 | "Description": "test-cluster", | |
15 | "GlobalReplicationGroupInfo": { | |
16 | "GlobalReplicationGroupId": "sgaui-pat-group", | |
17 | "GlobalReplicationGroupMemberRole": "PRIMARY" | |
18 | }, | |
17 | 19 | "Status": "available", |
18 | 20 | "PendingModifiedValues": {}, |
19 | 21 | "MemberClusters": [ |
20 | "mycluster-0001-001", | |
21 | "mycluster-0001-002", | |
22 | "mycluster-0001-003", | |
23 | "mycluster-0003-001", | |
24 | "mycluster-0003-002", | |
25 | "mycluster-0003-003", | |
26 | "mycluster-0004-001", | |
27 | "mycluster-0004-002", | |
28 | "mycluster-0004-003" | |
22 | "test-cluster-001", | |
23 | "test-cluster-002", | |
24 | "test-cluster-003" | |
29 | 25 | ], |
30 | 26 | "NodeGroups": [ |
31 | 27 | { |
32 | 28 | "NodeGroupId": "0001", |
33 | 29 | "Status": "available", |
34 | "Slots": "0-1767,3134-5461,6827-8191", | |
30 | "PrimaryEndpoint": { | |
31 | "Address": "test-cluster.g2xbih.ng.0001.usw2.cache.amazonaws.com", | |
32 | "Port": 6379 | |
33 | }, | |
34 | "ReaderEndpoint": { | |
35 | "Address": "test-cluster-ro.g2xbih.ng.0001.usw2.cache.amazonaws.com", | |
36 | "Port": 6379 | |
37 | }, | |
35 | 38 | "NodeGroupMembers": [ |
36 | 39 | { |
37 | "CacheClusterId": "mycluster-0001-001", | |
40 | "CacheClusterId": "test-cluster-001", | |
38 | 41 | "CacheNodeId": "0001", |
39 | "PreferredAvailabilityZone": "us-west-2b" | |
42 | "ReadEndpoint": { | |
43 | "Address": "test-cluster-001.g2xbih.0001.usw2.cache.amazonaws.com", | |
44 | "Port": 6379 | |
45 | }, | |
46 | "PreferredAvailabilityZone": "us-west-2c", | |
47 | "CurrentRole": "primary" | |
40 | 48 | }, |
41 | 49 | { |
42 | "CacheClusterId": "mycluster-0001-002", | |
50 | "CacheClusterId": "test-cluster-002", | |
43 | 51 | "CacheNodeId": "0001", |
44 | "PreferredAvailabilityZone": "us-west-2a" | |
52 | "ReadEndpoint": { | |
53 | "Address": "test-cluster-002.g2xbih.0001.usw2.cache.amazonaws.com", | |
54 | "Port": 6379 | |
55 | }, | |
56 | "PreferredAvailabilityZone": "us-west-2b", | |
57 | "CurrentRole": "replica" | |
45 | 58 | }, |
46 | 59 | { |
47 | "CacheClusterId": "mycluster-0001-003", | |
60 | "CacheClusterId": "test-cluster-003", | |
48 | 61 | "CacheNodeId": "0001", |
49 | "PreferredAvailabilityZone": "us-west-2c" | |
50 | } | |
51 | ] | |
52 | }, | |
53 | { | |
54 | "NodeGroupId": "0003", | |
55 | "Status": "available", | |
56 | "Slots": "5462-6826,10923-11075,12441-16383", | |
57 | "NodeGroupMembers": [ | |
58 | { | |
59 | "CacheClusterId": "mycluster-0003-001", | |
60 | "CacheNodeId": "0001", | |
61 | "PreferredAvailabilityZone": "us-west-2c" | |
62 | }, | |
63 | { | |
64 | "CacheClusterId": "mycluster-0003-002", | |
65 | "CacheNodeId": "0001", | |
66 | "PreferredAvailabilityZone": "us-west-2b" | |
67 | }, | |
68 | { | |
69 | "CacheClusterId": "mycluster-0003-003", | |
70 | "CacheNodeId": "0001", | |
71 | "PreferredAvailabilityZone": "us-west-2a" | |
72 | } | |
73 | ] | |
74 | }, | |
75 | { | |
76 | "NodeGroupId": "0004", | |
77 | "Status": "available", | |
78 | "Slots": "1768-3133,8192-10922,11076-12440", | |
79 | "NodeGroupMembers": [ | |
80 | { | |
81 | "CacheClusterId": "mycluster-0004-001", | |
82 | "CacheNodeId": "0001", | |
83 | "PreferredAvailabilityZone": "us-west-2b" | |
84 | }, | |
85 | { | |
86 | "CacheClusterId": "mycluster-0004-002", | |
87 | "CacheNodeId": "0001", | |
88 | "PreferredAvailabilityZone": "us-west-2a" | |
89 | }, | |
90 | { | |
91 | "CacheClusterId": "mycluster-0004-003", | |
92 | "CacheNodeId": "0001", | |
93 | "PreferredAvailabilityZone": "us-west-2c" | |
62 | "ReadEndpoint": { | |
63 | "Address": "test-cluster-003.g2xbih.0001.usw2.cache.amazonaws.com", | |
64 | "Port": 6379 | |
65 | }, | |
66 | "PreferredAvailabilityZone": "us-west-2a", | |
67 | "CurrentRole": "replica" | |
94 | 68 | } |
95 | 69 | ] |
96 | 70 | } |
97 | 71 | ], |
72 | "SnapshottingClusterId": "test-cluster-002", | |
98 | 73 | "AutomaticFailover": "enabled", |
99 | "ConfigurationEndpoint": { | |
100 | "Address": "mycluster.xxxxxx.clustercfg.usw2.cache.amazonaws.com", | |
101 | "Port": 6379 | |
102 | }, | |
74 | "MultiAZ": "disabled", | |
103 | 75 | "SnapshotRetentionLimit": 1, |
104 | "SnapshotWindow": "13:00-14:00", | |
105 | "ClusterEnabled": true, | |
76 | "SnapshotWindow": "08:00-09:00", | |
77 | "ClusterEnabled": false, | |
106 | 78 | "CacheNodeType": "cache.r5.large", |
107 | 79 | "TransitEncryptionEnabled": false, |
108 | 80 | "AtRestEncryptionEnabled": false |
109 | 81 | } |
110 | 82 | } |
111 | 83 | |
112 | For more information, see `Modifying a Replication Group <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Replication.Modify.html`>__ in the *Elasticache User Guide*. | |
84 | For more information, see `Modifying a Replication Group <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Replication.Modify.html>`__ in the *Elasticache User Guide*.⏎ |
0 | **To purchase a reserved-cache-node-offering** | |
1 | ||
2 | The following ``purchase-reserved-cache-nodes-offering`` example allows you to purchase a reserved cache node offering. :: | |
3 | ||
4 | aws elasticache purchase-reserved-cache-nodes-offering \ | |
5 | --reserved-cache-nodes-offering-id xxxxxxx-4da5-4b90-b92d-929fbd7abed2 | |
6 | ||
7 | Output :: | |
8 | ||
9 | { | |
10 | "ReservedCacheNode": { | |
11 | "ReservedCacheNodeId": "ri-2020-06-30-17-59-40-474", | |
12 | "ReservedCacheNodesOfferingId": "xxxxxxx-4da5-4b90-b92d-929fbd7abed2", | |
13 | "CacheNodeType": "cache.m3.2xlarge", | |
14 | "StartTime": "2020-06-30T17:59:40.474000+00:00", | |
15 | "Duration": 31536000, | |
16 | "FixedPrice": 1772.0, | |
17 | "UsagePrice": 0.0, | |
18 | "CacheNodeCount": 1, | |
19 | "ProductDescription": "redis", | |
20 | "OfferingType": "Heavy Utilization", | |
21 | "State": "payment-pending", | |
22 | "RecurringCharges": [ | |
23 | { | |
24 | "RecurringChargeAmount": 0.25, | |
25 | "RecurringChargeFrequency": "Hourly" | |
26 | } | |
27 | ] | |
28 | } | |
29 | } | |
30 | ||
31 | For more information, see `Getting Info About Reserved Node Offerings <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/reserved-nodes-offerings.html>`__ in the *Elasticache Redis User Guide* or `Getting Info About Reserved Node Offerings <https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/reserved-nodes-offerings.html>`__ in the *Elasticache Memcached User Guide*. |
0 | **To start a migration** | |
1 | ||
2 | The following ``start-migratio`` migrates your data from self-hosted Redis on Amazon EC2 to Amazon ElastiCache, using the Redis engine. :: | |
3 | ||
4 | aws elasticache start-migration \ | |
5 | --replication-group-id test \ | |
6 | --customer-node-endpoint-list "Address='test.g2xbih.ng.0001.usw2.cache.amazonaws.com',Port=6379" | |
7 | ||
8 | Output :: | |
9 | ||
10 | { | |
11 | "ReplicationGroup": { | |
12 | "ReplicationGroupId": "test", | |
13 | "Description": "test", | |
14 | "GlobalReplicationGroupInfo": {}, | |
15 | "Status": "modifying", | |
16 | "PendingModifiedValues": {}, | |
17 | "MemberClusters": [ | |
18 | "test-001", | |
19 | "test-002", | |
20 | "test-003" | |
21 | ], | |
22 | "NodeGroups": [ | |
23 | { | |
24 | "NodeGroupId": "0001", | |
25 | "Status": "available", | |
26 | "PrimaryEndpoint": { | |
27 | "Address": "test.g2xbih.ng.0001.usw2.cache.amazonaws.com", | |
28 | "Port": 6379 | |
29 | }, | |
30 | "ReaderEndpoint": { | |
31 | "Address": "test-ro.g2xbih.ng.0001.usw2.cache.amazonaws.com", | |
32 | "Port": 6379 | |
33 | }, | |
34 | "NodeGroupMembers": [ | |
35 | { | |
36 | "CacheClusterId": "test-001", | |
37 | "CacheNodeId": "0001", | |
38 | "ReadEndpoint": { | |
39 | "Address": "test-001.g2xbih.0001.usw2.cache.amazonaws.com", | |
40 | "Port": 6379 | |
41 | }, | |
42 | "PreferredAvailabilityZone": "us-west-2a", | |
43 | "CurrentRole": "primary" | |
44 | }, | |
45 | { | |
46 | "CacheClusterId": "test-002", | |
47 | "CacheNodeId": "0001", | |
48 | "ReadEndpoint": { | |
49 | "Address": "test-002.g2xbih.0001.usw2.cache.amazonaws.com", | |
50 | "Port": 6379 | |
51 | }, | |
52 | "PreferredAvailabilityZone": "us-west-2c", | |
53 | "CurrentRole": "replica" | |
54 | }, | |
55 | { | |
56 | "CacheClusterId": "test-003", | |
57 | "CacheNodeId": "0001", | |
58 | "ReadEndpoint": { | |
59 | "Address": "test-003.g2xbih.0001.usw2.cache.amazonaws.com", | |
60 | "Port": 6379 | |
61 | }, | |
62 | "PreferredAvailabilityZone": "us-west-2b", | |
63 | "CurrentRole": "replica" | |
64 | } | |
65 | ] | |
66 | } | |
67 | ], | |
68 | "SnapshottingClusterId": "test-002", | |
69 | "AutomaticFailover": "enabled", | |
70 | "MultiAZ": "enabled", | |
71 | "SnapshotRetentionLimit": 1, | |
72 | "SnapshotWindow": "07:30-08:30", | |
73 | "ClusterEnabled": false, | |
74 | "CacheNodeType": "cache.r5.large", | |
75 | "TransitEncryptionEnabled": false, | |
76 | "AtRestEncryptionEnabled": false | |
77 | } | |
78 | } | |
79 | ||
80 | For more information, see `Online Migration to ElastiCache <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/OnlineMigration.html>`__ in the *Elasticache User Guide*.⏎ |
0 | **To list the available delivery streams** | |
1 | ||
2 | The following ``list-delivery-streams`` example lists the available delivery streams in your AWS account. :: | |
3 | ||
4 | aws firehose list-delivery-streams | |
5 | ||
6 | Output:: | |
7 | ||
8 | { | |
9 | "DeliveryStreamNames": [ | |
10 | "my-stream" | |
11 | ], | |
12 | "HasMoreDeliveryStreams": false | |
13 | } | |
14 | ||
15 | For more information, see `Creating an Amazon Kinesis Data Firehose Delivery Stream <https://docs.aws.amazon.com/firehose/latest/dev/basic-create.html>`__ in the *Amazon Kinesis Data Firehose Developer Guide*. |
0 | **To write multiple records to a stream** | |
1 | ||
2 | The following ``put-record-batch`` example writes three records to a stream. The data is encoded in Base64 format. :: | |
3 | ||
4 | aws firehose put-record-batch \ | |
5 | --delivery-stream-name my-stream \ | |
6 | --records file://records.json | |
7 | ||
8 | Contents of ``myfile.json``:: | |
9 | ||
10 | [ | |
11 | {"Data": "Rmlyc3QgdGhpbmc="}, | |
12 | {"Data": "U2Vjb25kIHRoaW5n"}, | |
13 | {"Data": "VGhpcmQgdGhpbmc="} | |
14 | ] | |
15 | ||
16 | Output:: | |
17 | ||
18 | { | |
19 | "FailedPutCount": 0, | |
20 | "Encrypted": false, | |
21 | "RequestResponses": [ | |
22 | { | |
23 | "RecordId": "9D2OJ6t2EqCTZTXwGzeSv/EVHxRoRCw89xd+o3+sXg8DhYOaWKPSmZy/CGlRVEys1u1xbeKh6VofEYKkoeiDrcjrxhQp9iF7sUW7pujiMEQ5LzlrzCkGosxQn+3boDnURDEaD42V7GiixpOyLJkYZcae1i7HzlCEoy9LJhMr8EjDSi4Om/9Vc2uhwwuAtGE0XKpxJ2WD7ZRWtAnYlKAnvgSPRgg7zOWL" | |
24 | }, | |
25 | { | |
26 | "RecordId": "jFirejqxCLlK5xjH/UNmlMVcjktEN76I7916X9PaZ+PVaOSXDfU1WGOqEZhxq2js7xcZ552eoeDxsuTU1MSq9nZTbVfb6cQTIXnm/GsuF37Uhg67GKmR5z90l6XKJ+/+pDloFv7Hh9a3oUS6wYm3DcNRLTHHAimANp1PhkQvWpvLRfzbuCUkBphR2QVzhP9OiHLbzGwy8/DfH8sqWEUYASNJKS8GXP5s" | |
27 | }, | |
28 | { | |
29 | "RecordId": "oy0amQ40o5Y2YV4vxzufdcMOOw6n3EPr3tpPJGoYVNKH4APPVqNcbUgefo1stEFRg4hTLrf2k6eliHu/9+YJ5R3iiedHkdsfkIqX0XTySSutvgFYTjNY1TSrK0pM2sWxpjqqnk3+2UX1MV5z88xGro3cQm/DTBt3qBlmTj7Xq8SKVbO1S7YvMTpWkMKA86f8JfmT8BMKoMb4XZS/sOkQLe+qh0sYKXWl" | |
30 | } | |
31 | ] | |
32 | } | |
33 | ||
34 | For more information, see `Sending Data to an Amazon Kinesis Data Firehose Delivery Stream <https://docs.aws.amazon.com/firehose/latest/dev/basic-write.html>`__ in the *Amazon Kinesis Data Firehose Developer Guide*. |
0 | **To write a record to a stream** | |
1 | ||
2 | The following ``put-record`` example writes data to a stream. The data is encoded in Base64 format. :: | |
3 | ||
4 | aws firehose put-record \ | |
5 | --delivery-stream-name my-stream \ | |
6 | --record '{"Data":"SGVsbG8gd29ybGQ="}' | |
7 | ||
8 | Output:: | |
9 | ||
10 | { | |
11 | "RecordId": "RjB5K/nnoGFHqwTsZlNd/TTqvjE8V5dsyXZTQn2JXrdpMTOwssyEb6nfC8fwf1whhwnItt4mvrn+gsqeK5jB7QjuLg283+Ps4Sz/j1Xujv31iDhnPdaLw4BOyM9Amv7PcCuB2079RuM0NhoakbyUymlwY8yt20G8X2420wu1jlFafhci4erAt7QhDEvpwuK8N1uOQ1EuaKZWxQHDzcG6tk1E49IPeD9k", | |
12 | "Encrypted": false | |
13 | } | |
14 | ||
15 | ||
16 | For more information, see `Sending Data to an Amazon Kinesis Data Firehose Delivery Stream <https://docs.aws.amazon.com/firehose/latest/dev/basic-write.html>`__ in the *Amazon Kinesis Data Firehose Developer Guide*. |
5 | 5 | --name ExampleAccelerator \ |
6 | 6 | --tags Key="Name",Value="Example Name" Key="Project",Value="Example Project" \ |
7 | 7 | --region us-west-2 \ |
8 | --ip-addresses 192.0.2.250,198.51.100.52 | |
8 | --ip-addresses 192.0.2.250 198.51.100.52 | |
9 | 9 | |
10 | 10 | Output:: |
11 | 11 |
0 | **To start a crawler** | |
1 | ||
2 | The following ``start-crawler`` example starts a crawler. :: | |
3 | ||
4 | aws glue start-crawler --name my-crawler | |
5 | ||
6 | Output:: | |
7 | ||
8 | None | |
9 | ||
10 | For more information, see `Defining Crawlers <https://docs.aws.amazon.com/glue/latest/dg/add-crawler.html>`__ in the *AWS Glue Developer Guide*. |
0 | **To start running a job** | |
1 | ||
2 | The following ``start-job-run`` example starts a job. :: | |
3 | ||
4 | aws glue start-job-run \ | |
5 | --job-name my-job | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "JobRunId": "jr_22208b1f44eb5376a60569d4b21dd20fcb8621e1a366b4e7b2494af764b82ded" | |
11 | } | |
12 | ||
13 | For more information, see `Authoring Jobs <https://docs.aws.amazon.com/glue/latest/dg/author-job.html>`__ in the *AWS Glue Developer Guide*. |
0 | 0 | **To enable an MFA device** |
1 | 1 | |
2 | After you ran the ``create-virtual-mfa-device`` command to create a new virtual MFA device, you can then assign this MFA device to a user. | |
3 | The following example assigns the MFA device with the serial number ``arn:aws:iam::210987654321:mfa/BobsMFADevice`` to the user ``Bob``. | |
4 | The command also synchronizes the device with AWS by including the first two codes in sequence from the virtual MFA device:: | |
2 | After you use the ``create-virtual-mfa-device`` command to create a new virtual MFA device, you can assign the MFA device to a user. The following ``enable-mfa-device`` example assigns the MFA device with the serial number ``arn:aws:iam::210987654321:mfa/BobsMFADevice`` to the user ``Bob``. The command also synchronizes the device with AWS by including the first two codes in sequence from the virtual MFA device. :: | |
5 | 3 | |
6 | aws iam enable-mfa-device --user-name Bob --serial-number arn:aws:iam::210987654321:mfa/BobsMFADevice --authentication-code-1 123456 --authentication-code-2 789012 | |
4 | aws iam enable-mfa-device \ | |
5 | --user-name Bob \ | |
6 | --serial-number arn:aws:iam::210987654321:mfa/BobsMFADevice \ | |
7 | --authentication-code1 123456 \ | |
8 | --authentication-code2 789012 | |
7 | 9 | |
10 | This command produces no output. | |
8 | 11 | |
9 | For more information, see `Using a Virtual MFA Device with AWS`_ in the *Using IAM* guide. | |
10 | ||
11 | .. _`Using a Virtual MFA Device with AWS`: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_VirtualMFA.html⏎ | |
12 | For more information, see `Enabling a Virtual MFA Device <http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_enable_virtual.html>`__ in the *AWS Identity and Access Management User Guide*. |
0 | **To synchronize the specified MFA device with AWS servers** | |
1 | ||
2 | This example synchronizes the MFA device that is associated with the IAM user ``Bob`` and whose ARN is ``arn:aws:iam::123456789012:mfa/BobsMFADevice`` | |
3 | with an authenticator program that provided the two authentication codes:: | |
4 | ||
5 | aws iam resync-mfa-device --user-name Bob --serial-number arn:aws:iam::210987654321:mfa/BobsMFADevice --authentication-code-1 123456 --authentication-code-2 987654 | |
6 | ||
7 | ||
8 | For more information, see `Using Multi-Factor Authentication (MFA) Devices with AWS`_ in the *IAM User* guide. | |
9 | ||
10 | .. _`Using Multi-Factor Authentication (MFA) Devices with AWS`: http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa.html⏎ | |
0 | **To synchronize an MFA device** | |
1 | ||
2 | The following ``resync-mfa-device`` example synchronizes the MFA device that is associated with the IAM user ``Bob`` and whose ARN is ``arn:aws:iam::123456789012:mfa/BobsMFADevice`` with an authenticator program that provided the two authentication codes. :: | |
3 | ||
4 | aws iam resync-mfa-device \ | |
5 | --user-name Bob \ | |
6 | --serial-number arn:aws:iam::210987654321:mfa/BobsMFADevice \ | |
7 | --authentication-code1 123456 \ | |
8 | --authentication-code2 987654 | |
9 | ||
10 | This command produces no output. | |
11 | ||
12 | For more information, see `Using Multi-Factor Authentication (MFA) Devices in AWS <http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa.html>`__ in the *AWS Identity and Access Management User Guide*.⏎ |
0 | **To confirm a topic rule destination** | |
1 | ||
2 | The following ``confirm-topic-rule-destination`` example confirms a topic rule destination with a confirmation token received at an HTTP endpoint. :: | |
3 | ||
4 | aws iot confirm-topic-rule-destination \ | |
5 | --confirmation-token "AYADeIcmtq-ZkxfpiWIQqHWM5ucAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREFxY1E0UmlGeDg0V21BZWZ1VjZtZWFRVUJJUktUYXJaN09OZlJOczJhRENSZmZYL3JHZC9PR3NNcis5T3ZlSitnQT09AAEAB2F3cy1rbXMAS2Fybjphd3M6a21zOnVzLWVhc3QtMTo5ODc5NTE4NTI0OTk6a2V5L2U4YmU3ODViLTU5NWMtNDcxYi1iOWJmLWQ2Y2I4ZjQxODlmNwC4AQIBAHhwz48UWTGWE1ua0P8U1hj27nsFzEaAdf6Hs2K_7wBheAF62zwMuk_A4dPiC6eyPGuMAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQM9vtRMpf9D3CiZ8sMAgEQgDuFd0Txy-aywpPqg8YEsa1lD4B40aJ2s1wEHKMybiF1RoOZzYisI0IvslzQY5UmCkqq3tV-3f7-nKfosgIAAAAADAAAEAAAAAAAAAAAAAAAAAAi9RMgy-V19V9m6Iw2xfbw_____wAAAAEAAAAAAAAAAAAAAAEAAAB1hw4SokgUcxiJ3gTO6n50NLJVpzyQR1UmPIj5sShqXEQGcOsWmXzpYOOx_PWyPVNsIFHApyK7Cc3g4bW8VaLVwOLkC83g6YaZAh7dFEl2-iufgrzTePl8RZYOWr0O6Aj9DiVzJZx-1iD6Pu-G6PUw1kaO7Knzs2B4AD0qfrHUF4pYRTvyUgBnMGUCMQC8ZRmhKqntd_c6Kgrow3bMUDBvNqo2qZr8Z8Jm2rzgseROlAnLgFLGpGShr99oSZkCMEd1v62NBRKX9HQXnybyF3fkg__-PIetJ803Z4IlIlF8xXlcdPGP-PV1dOXFemyL8g" | |
6 | ||
7 | This command produces no output. | |
8 | ||
9 | For more information, see `Confirming a topic rule destination <https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html#confirm-destination>`__ in the *AWS IoT Developer Guide*.⏎ |
0 | **To create a topic rule destination** | |
1 | ||
2 | The following ``create-topic-rule-destination`` example creates a topic rule destination for an HTTP endpoint. :: | |
3 | ||
4 | aws iot create-topic-rule-destination \ | |
5 | --destination-configuration httpUrlConfiguration={confirmationUrl=https://example.com} | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "topicRuleDestination": { | |
11 | "arn": "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", | |
12 | "status": "IN_PROGRESS", | |
13 | "statusReason": "Awaiting confirmation. Confirmation message sent on 2020-07-09T22:47:54.154Z; no response received from the endpoint.", | |
14 | "httpUrlProperties": { | |
15 | "confirmationUrl": "https://example.com" | |
16 | } | |
17 | } | |
18 | } | |
19 | ||
20 | For more information, see `Creating a topic rule destination <https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html#create-destination>`__ in the *AWS IoT Developer Guide*.⏎ |
0 | **To delete a topic rule destination** | |
1 | ||
2 | The following ``delete-topic-rule-destination`` example deletes the specified topic rule destination. :: | |
3 | ||
4 | aws iot delete-topic-rule-destination \ | |
5 | --arn "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE" | |
6 | ||
7 | This command produces no output. | |
8 | ||
9 | For more information, see `Deleting a topic rule destination <https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html#delete-destination>`__ in the *AWS IoT Developer Guide*.⏎ |
20 | 20 | "device4" |
21 | 21 | ], |
22 | 22 | "targetSelection": "SNAPSHOT", |
23 | "protocols": ["HTTP"], | |
23 | 24 | "awsJobExecutionsRolloutConfig": { |
24 | 25 | "maximumPerMinute": 10 |
25 | 26 | }, |
0 | **To get a topic rule destination** | |
1 | ||
2 | The following ``get-topic-rule-destination`` example gets information about a topic rule destination. :: | |
3 | ||
4 | aws iot get-topic-rule-destination \ | |
5 | --arn "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE" | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "topicRuleDestination": { | |
11 | "arn": "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", | |
12 | "status": "DISABLED", | |
13 | "httpUrlProperties": { | |
14 | "confirmationUrl": "https://example.com" | |
15 | } | |
16 | } | |
17 | } | |
18 | ||
19 | For more information, see `Working with topic rule destinations <https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html>`__ in the *AWS IoT Developer Guide*.⏎ |
0 | **To list your topic rule destinations** | |
1 | ||
2 | The following ``list-topic-rule-destinations`` example lists all topic rule destinations that you have defined in the current AWS Region. :: | |
3 | ||
4 | aws iot list-topic-rule-destinations | |
5 | ||
6 | Output:: | |
7 | ||
8 | { | |
9 | "destinationSummaries": [ | |
10 | { | |
11 | "arn": "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", | |
12 | "status": "ENABLED", | |
13 | "httpUrlSummary": { | |
14 | "confirmationUrl": "https://example.com" | |
15 | } | |
16 | } | |
17 | ] | |
18 | } | |
19 | ||
20 | For more information, see `Working with topic rule destinations <https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html>`__ in the *AWS IoT Developer Guide*.⏎ |
0 | **Example 1: To enable a topic rule destination** | |
1 | ||
2 | The following ``update-topic-rule-destination`` example enables traffic to a topic rule destination. :: | |
3 | ||
4 | aws iot update-topic-rule-destination \ | |
5 | --arn "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE" \ | |
6 | --status ENABLED | |
7 | ||
8 | This command produces no output. | |
9 | ||
10 | For more information, see `Enabling a topic rule destination <https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html#enable-destination>`__ in the *AWS IoT Developer Guide*. | |
11 | ||
12 | **Example 2: To disable a topic rule destination** | |
13 | ||
14 | The following ``update-topic-rule-destination`` example disables traffic to a topic rule destination. :: | |
15 | ||
16 | aws iot update-topic-rule-destination \ | |
17 | --arn "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE" \ | |
18 | --status DISABLED | |
19 | ||
20 | This command produces no output. | |
21 | ||
22 | For more information, see `Disabling a topic rule destination <https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html#disable-destination>`__ in the *AWS IoT Developer Guide*. | |
23 | ||
24 | **Example 3: To send a new confirmation message** | |
25 | ||
26 | The following ``update-topic-rule-destination`` example sends a new confirmation message for a topic rule destination. :: | |
27 | ||
28 | aws iot update-topic-rule-destination \ | |
29 | --arn "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE" \ | |
30 | --status IN_PROGRESS | |
31 | ||
32 | This command produces no output. | |
33 | ||
34 | For more information, see `Sending a new confirmation message <https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html#trigger-confirm>`__ in the *AWS IoT Developer Guide*.⏎ |
0 | **To get channel configuration information about multiple channels** | |
1 | ||
2 | The following ``batch-get-channel`` example lists information about the specified channels. :: | |
3 | ||
4 | aws ivs batch-get-channel \ | |
5 | --arns arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh \ | |
6 | arn:aws:ivs:us-west-2:123456789012:channel/ijklMNOPqrst | |
7 | ||
8 | Output:: | |
9 | ||
10 | { | |
11 | "channels": [ | |
12 | { | |
13 | "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
14 | "name": "channel-1", | |
15 | "latencyMode": "LOW", | |
16 | "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net", | |
17 | "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8", | |
18 | "tags": {} | |
19 | }, | |
20 | { | |
21 | "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
22 | "name": "channel-2", | |
23 | "latencyMode": "LOW", | |
24 | "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net", | |
25 | "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8", | |
26 | "tags": {} | |
27 | } | |
28 | ] | |
29 | } | |
30 | ||
31 | For more information, see `Create a Channel <https://docs.aws.amazon.com/ivs/latest/userguide/GSIVS-create-channel.html>`__ in the *Amazon Interactive Video Service User Guide*.⏎ |
0 | **To get information about multiple stream keys** | |
1 | ||
2 | The following ``batch-get-stream-key`` example gets information about the specified stream keys. :: | |
3 | ||
4 | aws ivs batch-get-stream-key \ | |
5 | --arns arn:aws:ivs:us-west-2:123456789012:stream-key/skSKABCDefgh \ | |
6 | arn:aws:ivs:us-west-2:123456789012:stream-key/skSKIJKLmnop | |
7 | ||
8 | Output:: | |
9 | ||
10 | { | |
11 | "streamKeys": [ | |
12 | { | |
13 | "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/skSKABCDefgh", | |
14 | "value": "sk_us-west-2_abcdABCDefgh_567890abcdef", | |
15 | "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
16 | "tags": {} | |
17 | }, | |
18 | { | |
19 | "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/skSKIJKLmnop", | |
20 | "value": "sk_us-west-2_abcdABCDefgh_567890ghijkl", | |
21 | "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
22 | "tags": {} | |
23 | } | |
24 | ] | |
25 | } | |
26 | ||
27 | For more information, see `Create a Channel <https://docs.aws.amazon.com/ivs/latest/userguide/GSIVS-create-channel.html>`__ in the *Amazon Interactive Video Service User Guide*.⏎ |
0 | **To create channels** | |
1 | ||
2 | The following ``create-channel`` example creates a new channel and an associated stream key to start streaming. :: | |
3 | ||
4 | aws ivs create-channel | |
5 | ||
6 | Output:: | |
7 | ||
8 | { | |
9 | "channel": { | |
10 | "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
11 | "name": "test-channel", | |
12 | "latencyMode": "LOW", | |
13 | "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net", | |
14 | "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8", | |
15 | "tags": {} | |
16 | }, | |
17 | "streamKey": { | |
18 | "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/g1H2I3j4k5L6", | |
19 | "value": "sk_us-west-2_abcdABCDefgh_567890abcdef", | |
20 | "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
21 | "tags": {} | |
22 | } | |
23 | } | |
24 | ||
25 | For more information, see `Create a Channel <https://docs.aws.amazon.com/ivs/latest/userguide/GSIVS-create-channel.html>`__ in the *Amazon Interactive Video Service User Guide*.⏎ |
0 | **To create a stream key** | |
1 | ||
2 | The following ``create-stream-key`` example creates a stream key for a specified ARN (Amazon Resource Name). :: | |
3 | ||
4 | aws ivs create-stream-key \ | |
5 | --channel-arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "streamKey": { | |
11 | "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/abcdABCDefgh", | |
12 | "value": "sk_us-west-2_abcdABCDefgh_567890abcdef", | |
13 | "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
14 | "tags": {} | |
15 | } | |
16 | } | |
17 | ||
18 | For more information, see `Create a Channel <https://docs.aws.amazon.com/ivs/latest/userguide/GSIVS-create-channel.html>`__ in the *Amazon Interactive Video Service User Guide*.⏎ |
0 | **To delete a stream key** | |
1 | ||
2 | The following ``delete-stream-key`` example deletes the stream key for a specified ARN (Amazon Resource Name), so it can no longer be used to stream. :: | |
3 | ||
4 | aws ivs delete-stream-key \ | |
5 | --arn arn:aws:ivs:us-west-2:123456789012:stream-key/g1H2I3j4k5L6 | |
6 | ||
7 | This command produces no output. | |
8 | ||
9 | For more information, see `Create a Channel <https://docs.aws.amazon.com/ivs/latest/userguide/GSIVS-create-channel.html>`__ in the *Amazon Interactive Video Service User Guide*.⏎ |
0 | **To get a channel's configuration information** | |
1 | ||
2 | The following ``get-channel`` example gets the channel configuration for a specified channel ARN (Amazon Resource Name). :: | |
3 | ||
4 | aws ivs get-channel \ | |
5 | --arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "channel": { | |
11 | "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
12 | "name": "channel-1", | |
13 | "latencyMode": "LOW", | |
14 | "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net", | |
15 | "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8", | |
16 | "tags": {} | |
17 | } | |
18 | } | |
19 | ||
20 | For more information, see `Create a Channel <https://docs.aws.amazon.com/ivs/latest/userguide/GSIVS-create-channel.html>`__ in the *Amazon Interactive Video Service User Guide*.⏎ |
0 | **To get information about a stream** | |
1 | ||
2 | The following ``get-stream-key`` example gets information about the specified stream key. :: | |
3 | ||
4 | aws ivs get-stream \ | |
5 | --channel-arn arn:aws:ivs:us-west-2:123456789012:stream-key/skSKABCDefgh | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "streamKey": { | |
11 | "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/skSKABCDefgh", | |
12 | "value": "sk_us-west-2_abcdABCDefgh_567890abcdef", | |
13 | "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
14 | "tags": {} | |
15 | } | |
16 | } | |
17 | ||
18 | For more information, see `Create a Channel <https://docs.aws.amazon.com/ivs/latest/userguide/GSIVS-create-channel.html>`__ in the *Amazon Interactive Video Service User Guide*.⏎ |
0 | **To get information about a stream** | |
1 | ||
2 | The following ``get-stream`` example gets information about the stream for the specified channel. :: | |
3 | ||
4 | aws ivs get-stream \ | |
5 | --channel-arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "stream": { | |
11 | "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
12 | "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8", | |
13 | "startTime": "2020-05-05T21:55:38Z", | |
14 | "state": "LIVE", | |
15 | "health": "HEALTHY", | |
16 | "viewerCount": 1 | |
17 | } | |
18 | } | |
19 | ||
20 | For more information, see `Create a Channel <https://docs.aws.amazon.com/ivs/latest/userguide/GSIVS-create-channel.html>`__ in the *Amazon Interactive Video Service User Guide*.⏎ |
0 | **To get summary information about channels** | |
1 | ||
2 | The following ``list-channels`` example lists all channels for your AWS account. :: | |
3 | ||
4 | aws ivs list-channels | |
5 | ||
6 | Output:: | |
7 | ||
8 | { | |
9 | "channels": [ | |
10 | { | |
11 | "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
12 | "name": "channel-1", | |
13 | "latencyMode": "LOW", | |
14 | "tags": {} | |
15 | }, | |
16 | { | |
17 | "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
18 | "name": "channel-2", | |
19 | "latencyMode": "LOW", | |
20 | "tags": {} | |
21 | } | |
22 | ] | |
23 | } | |
24 | ||
25 | For more information, see `Create a Channel <https://docs.aws.amazon.com/ivs/latest/userguide/GSIVS-create-channel.html>`__ in the *Amazon Interactive Video Service User Guide*.⏎ |
0 | **To get a list of stream keys** | |
1 | ||
2 | The following ``list-stream-keys`` example lists all stream keys for a specified ARN (Amazon Resource Name). :: | |
3 | ||
4 | aws ivs list-stream-keys \ | |
5 | --channel-arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "streamKeys": [ | |
11 | { | |
12 | "arn": "arn:aws:ivs:us-west-2:123456789012:stream-key/abcdABCDefgh", | |
13 | "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
14 | "tags": {} | |
15 | } | |
16 | ] | |
17 | } | |
18 | ||
19 | For more information, see `Create a Channel <https://docs.aws.amazon.com/ivs/latest/userguide/GSIVS-create-channel.html>`__ in the *Amazon Interactive Video Service User Guide*.⏎ |
0 | **To get a list of live streams and their state** | |
1 | ||
2 | The following ``list-streams`` example lists all live streams for your AWS account. :: | |
3 | ||
4 | aws ivs list-streams | |
5 | ||
6 | Output:: | |
7 | ||
8 | { | |
9 | "streams": [ | |
10 | { | |
11 | "channelArn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
12 | "state": "LIVE", | |
13 | "health": "HEALTHY", | |
14 | "viewerCount": 1 | |
15 | } | |
16 | ] | |
17 | } | |
18 | ||
19 | For more information, see `Create a Channel <https://docs.aws.amazon.com/ivs/latest/userguide/GSIVS-create-channel.html>`__ in the *Amazon Interactive Video Service User Guide*.⏎ |
0 | **To insert metadata into the active stream for a specified channel** | |
1 | ||
2 | The following ``put-metadata`` example inserts the given metadata into the stream for the specified channel. :: | |
3 | ||
4 | aws ivs put-metadata \ | |
5 | --channel-arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh \ | |
6 | --metadata '{"my": "metadata"}' | |
7 | ||
8 | This command produces no output. | |
9 | ||
10 | For more information, see `Create a Channel <https://docs.aws.amazon.com/ivs/latest/userguide/GSIVS-create-channel.html>`__ in the *Amazon Interactive Video Service User Guide*.⏎ |
0 | **To stop a specified stream** | |
1 | ||
2 | The following ``stop-stream`` example stops the stream on the specified channel. :: | |
3 | ||
4 | aws ivs stop-stream \ | |
5 | --channel-arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh | |
6 | ||
7 | This command produces no output. | |
8 | ||
9 | For more information, see `Create a Channel <https://docs.aws.amazon.com/ivs/latest/userguide/GSIVS-create-channel.html>`__ in the *Amazon Interactive Video Service User Guide*.⏎ |
0 | **To update a channel's configuration information** | |
1 | ||
2 | The following ``update-channel`` example updates the channel configuration for a specified channel ARN (Amazon Resource Name). This does not affect an ongoing stream of this channel; you must stop and restart the stream for the changes to take effect. :: | |
3 | ||
4 | aws ivs update-channel \ | |
5 | --arn arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh \ | |
6 | --name "channel-1" | |
7 | ||
8 | Output:: | |
9 | ||
10 | { | |
11 | "channel": { | |
12 | "arn": "arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh", | |
13 | "name": "channel-1", | |
14 | "latencyMode": "LOW", | |
15 | "ingestEndpoint": "a1b2c3d4e5f6.global-contribute.live-video.net", | |
16 | "playbackUrl": "https://a1b2c3d4e5f6.us-west-2.playback.live-video.net/api/video/v1/us-west-2.123456789012.channel.abcdEFGH.m3u8", | |
17 | "tags": {} | |
18 | } | |
19 | ||
20 | For more information, see `Create a Channel <https://docs.aws.amazon.com/ivs/latest/userguide/GSIVS-create-channel.html>`__ in the *Amazon Interactive Video Service User Guide*.⏎ |
0 | **To describe a cluster** | |
1 | ||
2 | The following ``describe-cluster`` example describes an Amazon MSK cluster. :: | |
3 | ||
4 | aws kafka describe-cluster \ | |
5 | --cluster-arn arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5 | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "ClusterInfo": { | |
11 | "BrokerNodeGroupInfo": { | |
12 | "BrokerAZDistribution": "DEFAULT", | |
13 | "ClientSubnets": [ | |
14 | "subnet-cbfff283", | |
15 | "subnet-6746046b" | |
16 | ], | |
17 | "InstanceType": "kafka.m5.large", | |
18 | "SecurityGroups": [ | |
19 | "sg-f839b688" | |
20 | ], | |
21 | "StorageInfo": { | |
22 | "EbsStorageInfo": { | |
23 | "VolumeSize": 100 | |
24 | } | |
25 | } | |
26 | }, | |
27 | "ClusterArn": "arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5", | |
28 | "ClusterName": "demo-cluster-1", | |
29 | "CreationTime": "2020-07-09T02:31:36.223000+00:00", | |
30 | "CurrentBrokerSoftwareInfo": { | |
31 | "KafkaVersion": "2.2.1" | |
32 | }, | |
33 | "CurrentVersion": "K3AEGXETSR30VB", | |
34 | "EncryptionInfo": { | |
35 | "EncryptionAtRest": { | |
36 | "DataVolumeKMSKeyId": "arn:aws:kms:us-east-1:123456789012:key/a7ca56d5-0768-4b64-a670-339a9fbef81c" | |
37 | }, | |
38 | "EncryptionInTransit": { | |
39 | "ClientBroker": "TLS_PLAINTEXT", | |
40 | "InCluster": true | |
41 | } | |
42 | }, | |
43 | "EnhancedMonitoring": "DEFAULT", | |
44 | "OpenMonitoring": { | |
45 | "Prometheus": { | |
46 | "JmxExporter": { | |
47 | "EnabledInBroker": false | |
48 | }, | |
49 | "NodeExporter": { | |
50 | "EnabledInBroker": false | |
51 | } | |
52 | } | |
53 | }, | |
54 | "NumberOfBrokerNodes": 2, | |
55 | "State": "ACTIVE", | |
56 | "Tags": {}, | |
57 | "ZookeeperConnectString": "z-2.demo-cluster-1.xuy0sb.c5.kafka.us-east-1.amazonaws.com:2181,z-1.demo-cluster-1.xuy0sb.c5.kafka.us-east-1.amazonaws.com:2181,z-3.demo-cluster-1.xuy0sb.c5.kafka.us-east-1.amazonaws.com:2181" | |
58 | } | |
59 | } | |
60 | ||
61 | For more information, see `Listing Amazon MSK Clusters <https://docs.aws.amazon.com/msk/latest/developerguide/msk-list-clusters.html>`__ in the *Amazon Managed Streaming for Apache Kafka Developer Guide*. |
0 | **To get bootstrap brokers** | |
1 | ||
2 | The following ``get-bootstrap-brokers`` example retrieves the bootstrap broker information for an Amazon MSK cluster. :: | |
3 | ||
4 | aws kafka get-bootstrap-brokers \ | |
5 | --cluster-arn arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5 | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "BootstrapBrokerString": "b-1.demo-cluster-1.xuy0sb.c5.kafka.us-east-1.amazonaws.com:9092,b-2.demo-cluster-1.xuy0sb.c5.kafka.us-east-1.amazonaws.com:9092", | |
11 | "BootstrapBrokerStringTls": "b-1.demo-cluster-1.xuy0sb.c5.kafka.us-east-1.amazonaws.com:9094,b-2.demo-cluster-1.xuy0sb.c5.kafka.us-east-1.amazonaws.com:9094" | |
12 | } | |
13 | ||
14 | For more information, see `Getting the Bootstrap Brokers <https://docs.aws.amazon.com/msk/latest/developerguide/msk-get-bootstrap-brokers.html>`__ in the *Amazon Managed Streaming for Apache Kafka Developer Guide*. | |
15 | ||
16 | ||
17 |
0 | **To list the available clusters** | |
1 | ||
2 | The following ``list-clusters`` example lists the Amazon MSK clusters in your AWS account. :: | |
3 | ||
4 | aws kafka list-clusters | |
5 | ||
6 | Output:: | |
7 | ||
8 | { | |
9 | "ClusterInfoList": [ | |
10 | { | |
11 | "BrokerNodeGroupInfo": { | |
12 | "BrokerAZDistribution": "DEFAULT", | |
13 | "ClientSubnets": [ | |
14 | "subnet-cbfff283", | |
15 | "subnet-6746046b" | |
16 | ], | |
17 | "InstanceType": "kafka.m5.large", | |
18 | "SecurityGroups": [ | |
19 | "sg-f839b688" | |
20 | ], | |
21 | "StorageInfo": { | |
22 | "EbsStorageInfo": { | |
23 | "VolumeSize": 100 | |
24 | } | |
25 | } | |
26 | }, | |
27 | "ClusterArn": "arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5", | |
28 | "ClusterName": "demo-cluster-1", | |
29 | "CreationTime": "2020-07-09T02:31:36.223000+00:00", | |
30 | "CurrentBrokerSoftwareInfo": { | |
31 | "KafkaVersion": "2.2.1" | |
32 | }, | |
33 | "CurrentVersion": "K3AEGXETSR30VB", | |
34 | "EncryptionInfo": { | |
35 | "EncryptionAtRest": { | |
36 | "DataVolumeKMSKeyId": "arn:aws:kms:us-east-1:123456789012:key/a7ca56d5-0768-4b64-a670-339a9fbef81c" | |
37 | }, | |
38 | "EncryptionInTransit": { | |
39 | "ClientBroker": "TLS_PLAINTEXT", | |
40 | "InCluster": true | |
41 | } | |
42 | }, | |
43 | "EnhancedMonitoring": "DEFAULT", | |
44 | "OpenMonitoring": { | |
45 | "Prometheus": { | |
46 | "JmxExporter": { | |
47 | "EnabledInBroker": false | |
48 | }, | |
49 | "NodeExporter": { | |
50 | "EnabledInBroker": false | |
51 | } | |
52 | } | |
53 | }, | |
54 | "NumberOfBrokerNodes": 2, | |
55 | "State": "ACTIVE", | |
56 | "Tags": {}, | |
57 | "ZookeeperConnectString": "z-2.demo-cluster-1.xuy0sb.c5.kafka.us-east-1.amazonaws.com:2181,z-1.demo-cluster-1.xuy0sb.c5.kafka.us-east-1.amazonaws.com:2181,z-3.demo-cluster-1.xuy0sb.c5.kafka.us-east-1.amazonaws.com:2181" | |
58 | } | |
59 | ] | |
60 | } | |
61 | ||
62 | For more information, see `Listing Amazon MSK Clusters <https://docs.aws.amazon.com/msk/latest/developerguide/msk-list-clusters.html>`__ in the *Amazon Managed Streaming for Apache Kafka Developer Guide*. |
0 | **To delete imported key material from a customer master key (CMK)** | |
1 | ||
2 | The following ``delete-imported-key-material`` example deletes key material that had been imported into a CMK. To specify the CMK, use the ``key-id`` parameter. This example uses an key ID value, but you can use a key ID or key ARN value in this command. | |
3 | ||
4 | Before running this command, replace the example key ID with a valid one. :: | |
5 | ||
6 | aws kms delete-imported-key-material \ | |
7 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab | |
8 | ||
9 | This command produces no output. To verify that the key material is deleted, use the ``describe-key`` command to look for a key state of ``PendingImport`` or ``PendingDeletion``. | |
10 | ||
11 | For more information, see `Deleting imported key material<https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-delete-key-material.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | 0 | **To find detailed information about a customer master key (CMK)** |
1 | 1 | |
2 | The following ``describe-key`` example retrieves detailed information about the AWS managed CMK for Amazon S3. | |
2 | The following ``describe-key`` example gets detailed information about the AWS managed CMK for Amazon S3 in the example account and Region. You can use this command to find details about AWS managed CMKs and customer managed CMKs. | |
3 | 3 | |
4 | This example uses an alias name value for the ``--key-id`` parameter, but you can use a key ID, key ARN, alias name, or alias ARN in this command. :: | |
4 | To specify the CMK, use the ``key-id`` parameter. This example uses an alias name value, but you can use a key ID, key ARN, alias name, or alias ARN in this command. :: | |
5 | 5 | |
6 | aws kms describe-key --key-id alias/aws/s3 | |
6 | aws kms describe-key \ | |
7 | --key-id alias/aws/s3 | |
7 | 8 | |
8 | 9 | Output:: |
9 | 10 | |
10 | 11 | { |
11 | 12 | "KeyMetadata": { |
13 | "AWSAccountId": "846764612917", | |
14 | "KeyId": "b8a9477d-836c-491f-857e-07937918959b", | |
15 | "Arn": "arn:aws:kms:us-west-2:846764612917:key/b8a9477d-836c-491f-857e-07937918959b", | |
16 | "CreationDate": 1566518783.394, | |
17 | "Enabled": true, | |
12 | 18 | "Description": "Default master key that protects my S3 objects when no other key is defined", |
13 | "Arn": "arn:aws:kms:us-west-2:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab", | |
19 | "KeyUsage": "ENCRYPT_DECRYPT", | |
14 | 20 | "KeyState": "Enabled", |
15 | 21 | "Origin": "AWS_KMS", |
16 | "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", | |
17 | "KeyUsage": "ENCRYPT_DECRYPT", | |
18 | "AWSAccountId": "123456789012", | |
19 | "Enabled": true, | |
20 | 22 | "KeyManager": "AWS", |
21 | "CreationDate": 1566518783.394 | |
23 | "CustomerMasterKeySpec": "SYMMETRIC_DEFAULT", | |
24 | "EncryptionAlgorithms": [ | |
25 | "SYMMETRIC_DEFAULT" | |
26 | ] | |
22 | 27 | } |
23 | 28 | } |
24 | 29 | |
25 | For more information, see `Viewing Keys<https://docs.aws.amazon.com/kms/latest/developerguide/viewing-keys.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ | |
30 | For more information, see `Viewing Keys <https://docs.aws.amazon.com/kms/latest/developerguide/viewing-keys.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **To disable automatic rotation of a customer master key (CMK)** | |
1 | ||
2 | The following ``disable-key-rotation`` example disables automatic rotation of a customer managed CMK. To reenable automatic rotation, use the ``enable-key-rotation`` command. | |
3 | ||
4 | To specify the CMK, use the ``key-id`` parameter. This example uses an key ARN value, but you can use a key ID or key ARN in this command. Before running this command, replace the example key ARN with a valid one. :: | |
5 | ||
6 | aws kms disable-key-rotation \ | |
7 | --key-id arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab | |
8 | ||
9 | This command produces no output. To verify that automatic rotation is disable for the CMK, use the ``get-key-rotation-status`` command. | |
10 | ||
11 | For more information, see `Rotating Keys <https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **To temporarily disable a customer master key (CMK)** | |
1 | ||
2 | The following example uses the ``disable-key`` command to disable a customer managed CMK. You can use a command like this one to prevent the CMK from being used in cryptographic operations. Disabling is always temporary. To re-enable the CMK, use the ``enable-key`` command. | |
3 | ||
4 | To specify the CMK, use the ``key-id`` parameter. This example uses an key ID value, but you can use a key ID or key ARN value in this command. Before running this command, replace the example key ID with a valid one. :: | |
5 | ||
6 | aws kms enable-key \ | |
7 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab | |
8 | ||
9 | This command produces no output. | |
10 | ||
11 | For more information, see `Enabling and Disabling Keys <https://docs.aws.amazon.com/kms/latest/developerguide/enabling-keys.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | 0 | **To disconnect a custom key store** |
1 | 1 | |
2 | The following ``disconnect-custom-key-store`` example disconnects the specified custom key store. :: | |
2 | The following ``disconnect-custom-key-store`` example disconnects a custom key store from its AWS CloudHSM cluster. You might disconnect a key store to troubleshoot a problem, to update its settings, or to prevent CMKs in the keystore from being used in cryptographic operations. | |
3 | 3 | |
4 | aws kms disconnect-custom-key-store \ | |
4 | Before running this command, replace the example custom key store ID with a valid one. :: | |
5 | ||
6 | $ aws kms disconnect-custom-key-store \ | |
5 | 7 | --custom-key-store-id cks-1234567890abcdef0 |
6 | 8 | |
7 | This command does not return any output. To verify that the command was effective, use the ``describe-custom-key-stores`` command. | |
9 | This command produces no output. verify that the command was effective, use the ``describe-custom-key-stores`` command. | |
8 | 10 | |
9 | For more information, see `Connecting and Disconnecting a Custom Key Store <https://docs.aws.amazon.com/kms/latest/developerguide/disconnect-keystore.html>`__ in the *AWS Key Management Service Developer Guide*. | |
11 | For more information, see `Connecting and Disconnecting a Custom Key Store <https://docs.aws.amazon.com/kms/latest/developerguide/disconnect-keystore.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **To enable automatic rotation of a customer master key (CMK)** | |
1 | ||
2 | The following ``enable-key-rotation`` example enables automatic rotation of a customer managed customer master key (CMK). The CMK will be rotated one year (365 days) from the date that this command completes and every year thereafter. | |
3 | ||
4 | To specify the CMK, use the ``key-id`` parameter. This example uses a key ARN value, but you can use a key ID or key ARN in this command. | |
5 | ||
6 | Before running this command, replace the example key ARN with a valid one. :: | |
7 | ||
8 | aws kms enable-key-rotation \ | |
9 | --key-id arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab | |
10 | ||
11 | This command produces no output. To verify that the CMK is enabled, use the ``get-key-rotation-status`` command. | |
12 | ||
13 | For more information, see `Rotating Keys <https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **To enable a customer master key (CMK)** | |
1 | ||
2 | The following ``enable-key`` example enables a customer managed customer master key (CMK). You can use a command like this one to enable a CMK that you temporarily disabled by using the ``disable-key`` command. You can also use it to enable a CMK that is disabled because it was scheduled for deletion and the deletion was canceled. | |
3 | ||
4 | To specify the CMK, use the ``key-id`` parameter. This example uses an key ID value, but you can use a key ID or key ARN value in this command. | |
5 | ||
6 | Before running this command, replace the example key ID with a valid one. :: | |
7 | ||
8 | aws kms enable-key \ | |
9 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab | |
10 | ||
11 | This command produces no output. To verify that the CMK is enabled, use the ``describe-key`` command. See the values of the ``KeyState`` and ``Enabled`` fields in the ``describe-key`` output. | |
12 | ||
13 | For more information, see `Enabling and Disabling Keys <https://docs.aws.amazon.com/kms/latest/developerguide/enabling-keys.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **Example 1: To generate a 256-bit random number** | |
0 | **Example 1: To generate a 256-bit random number (Linux or macOs)** | |
1 | 1 | |
2 | The following ``generate-random`` example generates a 256-bit (32-byte) random number. | |
2 | The following ``generate-random`` example generates a 256-bit (32-byte), base64-encoded random byte string. The example decodes the byte string and saves it in the `random` file. | |
3 | 3 | |
4 | 4 | When you run this command, you must use the ``number-of-bytes`` parameter to specify the length of the random number in bytes. |
5 | 5 | |
6 | You don't specify a CMK when you run this command. Unless you specify a `custom key store <https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html>`__, AWS KMS generates the random number. It is not associated with any particular CMK. :: | |
6 | You don't specify a CMK when you run this command. Unless you specify a `custom key store<https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html>`__, AWS KMS generates the random number. It is not associated with any particular CMK. | |
7 | 7 | |
8 | aws kms generate-random --number-of-bytes 32 | |
8 | This example uses the following parameters and values: | |
9 | 9 | |
10 | In the output, the random number is in the ``Plaintext`` field. :: | |
10 | * It uses the required ``--number-of-bytes`` parameter with a value of ``32`` to request a 32-byte (256-bit) string. | |
11 | * It uses the ``--output`` parameter with a value of ``text`` to direct the AWS CLI to return the output as text, instead of JSON. | |
12 | * It uses the ``--query parameter`` to extract the value of the ``Plaintext`` property from the response. | |
13 | * It pipes ( | ) the output of the command to the ``base64`` utility, which decodes the extracted output. | |
14 | * It uses the redirection operator ( > ) to save decoded byte string to the ``ExampleRandom`` file. | |
15 | * It uses the redirection operator ( > ) to save the binary ciphertext to a file. :: | |
11 | 16 | |
12 | { | |
13 | "Plaintext": "Hcl7v6T2E+Iangu357rhmlKZUnsb/LqzhHiNt6XNfQ0=" | |
14 | } | |
15 | ||
16 | **Example 2: To generate a 256-bit random number and save it to a file (Linux or macOs)** | |
17 | ||
18 | The following example uses the ``generate-random`` command to generate a 256-bit (32-byte), base64-encoded random byte string on a Linix or macOS computer. The example decodes the byte string and saves it in the ``ExampleRandom`` file. | |
19 | ||
20 | When you run this command, you must use the ``number-of-bytes`` parameter to specify the length of the random number in bytes. | |
21 | ||
22 | You don't specify a CMK when you run this command. Unless you specify a `custom key store <https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html>`__, AWS KMS generates the random number. It is not associated with any particular CMK. | |
23 | ||
24 | * The ``--number-of-bytes`` parameter with a value of ``32`` requests a 32-byte (256-bit) string. | |
25 | * The ``--output`` parameter with a value of ``text`` directs the AWS CLI to return the output as text, instead of JSON. | |
26 | * The ``--query`` parameter extracts the value of the ``Plaintext`` property from the response. | |
27 | * The pipe operator ( | ) sends the output of the command to the ``base64`` utility, which decodes the extracted output. | |
28 | * The redirection operator (>) saves the decoded byte string to the ``ExampleRandom`` file. | |
29 | ||
30 | aws kms generate-random --number-of-bytes 32 --output text --query Plaintext | base64 --decode > ExampleRandom | |
17 | aws kms generate-random \ | |
18 | --number-of-bytes 32 \ | |
19 | --output text \ | |
20 | --query Plaintext | base64 --decode > ExampleRandom | |
31 | 21 | |
32 | 22 | This command produces no output. |
33 | 23 | |
34 | **Example 3: To generate a 256-bit random number and save it to a file(Windows Command Prompt)** | |
24 | For more information, see `GenerateRandom <https://docs.aws.amazon.com/kms/latest/APIReference/API_GenerateRandom.html>`__ in the *AWS Key Management Service API Reference*. | |
35 | 25 | |
36 | The following example uses the ``generate-random`` command to generate a 256-bit (32-byte), base64-encoded random byte string. The example decodes the byte string and saves it in the `ExampleRandom.base64` file. | |
26 | **Example 2: To generate a 256-bit random number (Windows Command Prompt)** | |
37 | 27 | |
38 | This example is the same as the previous example, except that it uses the ``certutil`` utility in Windows to base64-decode the random byte string before saving it in a file. | |
28 | The following example uses the ``generate-random`` command to generate a 256-bit (32-byte), base64-encoded random byte string. The example decodes the byte string and saves it in the `random` file. This example is the same as the previous example, except that it uses the ``certutil`` utility in Windows to base64-decode the random byte string before saving it in a file. | |
39 | 29 | |
40 | The first command generates the base64-encoded random byte string and saves it in a temporary file, ``ExampleRandom.base64``. The second command uses the ``certutil -decode`` command to decode the base64-encoded byte string in the ``ExampleRandom.base64`` file. Then, it saves the decoded byte string in the ``ExampleRandom`` file. :: | |
41 | ||
42 | aws kms generate-random --number-of-bytes 32 --output text --query Plaintext > ExampleRandom.base64 | |
30 | First, generate a base64-encoded random byte string and saves it in a temporary file, ``ExampleRandom.base64``. :: | |
31 | ||
32 | aws kms generate-random \ | |
33 | --number-of-bytes 32 \ | |
34 | --output text \ | |
35 | --query Plaintext > ExampleRandom.base64 | |
36 | ||
37 | Because the output of the ``generate-random`` command is saved in a file, this example produces no output. | |
38 | ||
39 | Now use the ``certutil -decode`` command to decode the base64-encoded byte string in the ``ExampleRandom.base64`` file. Then, it saves the decoded byte string in the ``ExampleRandom`` file. :: | |
40 | ||
43 | 41 | certutil -decode ExampleRandom.base64 ExampleRandom |
44 | 42 | |
45 | 43 | Output:: |
48 | 46 | Output Length = 12 |
49 | 47 | CertUtil: -decode command completed successfully. |
50 | 48 | |
51 | For more information, see `GenerateRandom <https://docs.aws.amazon.com/kms/latest/APIReference/API_GenerateRandom.html>`__ in the *AWS Key Management Service API Reference*. | |
49 | For more information, see `GenerateRandom <https://docs.aws.amazon.com/kms/latest/APIReference/API_GenerateRandom.html>`__ in the *AWS Key Management Service API Reference*.⏎ |
0 | **To determine whether a customer master key (CMK) is automatically rotated.** | |
1 | ||
2 | The following ``get-key-rotation-status`` example determines whether a CMK is automatically rotated. You can use this command on customer managed CMKs and AWS managed CMKs. However, all AWS managed CMKs are automatically rotated every three years. | |
3 | ||
4 | To specify the CMK, use the ``key-id`` parameter. This example uses a key ARN value, but you can use a key ID or key ARN in this command. | |
5 | ||
6 | Before running this command, replace the example key ARN with a valid one. :: | |
7 | ||
8 | aws kms get-key-rotation-status \ | |
9 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab | |
10 | ||
11 | Output:: | |
12 | ||
13 | { | |
14 | "KeyRotationEnabled": true | |
15 | } | |
16 | ||
17 | For more information, see `Rotating Keys <https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **To get the items required to import key material into a CMK** | |
1 | ||
2 | The following ``get-parameters-for-import`` example gets the public key and import token that you need to import key material into a CMK. When you use the ``import-key-material`` command, be sure to use the import token and key material encrypted by the public key that were returned in the same ``get-parameters-for-import`` command. Also, the wrapping algorithm that you specify in this command must be one that you use to encrypt the key material with the public key. | |
3 | ||
4 | To specify the CMK, use the ``key-id`` parameter. This example uses an key ID, but you can use a key ID or key ARN in this command. :: | |
5 | ||
6 | aws kms get-parameters-for-import \ | |
7 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ | |
8 | --wrapping-algorithm RSAES_OAEP_SHA_256 \ | |
9 | --wrapping-key-spec RSA_2048 | |
10 | ||
11 | Output:: | |
12 | ||
13 | { | |
14 | "KeyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", | |
15 | "PublicKey": "<public key base64 encoded data>", | |
16 | "ImportToken": "<import token base64 encoded data>", | |
17 | "ParametersValidTo": 1593893322.32 | |
18 | } | |
19 | ||
20 | For more information, see `Download the public key and import token <https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-get-public-key-and-token.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **Example 1: To download the public key of an asymmetric CMK** | |
1 | ||
2 | The following ``get-public-key`` example downloads the public key of an asymmetric CMK. | |
3 | ||
4 | In addition to returning the public key, the output includes information that you need to use the public key safely outside of AWS KMS, including the key usage and supported encryption algorithms. | |
5 | ||
6 | Before running this command, replace the example key ID with a valid key ID from your AWS account. :: | |
7 | ||
8 | aws kms get-public-key \ | |
9 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab | |
10 | ||
11 | Output:: | |
12 | ||
13 | { | |
14 | "KeyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", | |
15 | "PublicKey": "jANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAl5epvg1/QtJhxSi2g9SDEVg8QV/...", | |
16 | "CustomerMasterKeySpec": "RSA_4096", | |
17 | "KeyUsage": "ENCRYPT_DECRYPT", | |
18 | "EncryptionAlgorithms": [ | |
19 | "RSAES_OAEP_SHA_1", | |
20 | "RSAES_OAEP_SHA_256" | |
21 | ] | |
22 | } | |
23 | ||
24 | For more information about using asymmetric CMKs in AWS KMS, see `Using Symmetric and Asymmetric Keys <https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html>`__ in the *AWS Key Management Service API Reference*. | |
25 | ||
26 | **Example 2: To convert a public key to DER format (Linux and macOS)** | |
27 | ||
28 | The following ``get-public-key`` example downloads the public key of an asymmetric CMK and saves it in a DER file. | |
29 | ||
30 | When you use the ``get-public-key`` command in the AWS CLI, it returns a DER-encoded X.509 public key that is Base64-encoded. This example gets the value of the PublicKey property as text. It Base64-decodes the ``PublicKey`` and saves it in the ``public_key.der`` file. The ``output`` parameter returns the output as text, instead of JSON. The ``--query`` parameter gets only the ``PublicKey`` property, not the properties that you need to use the public key safely outside of AWS KMS. | |
31 | ||
32 | Before running this command, replace the example key ID with a valid key ID from your AWS account. :: | |
33 | ||
34 | aws kms get-public-key \ | |
35 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ | |
36 | --output text \ | |
37 | --query PublicKey | base64 --decode > public_key.der | |
38 | ||
39 | This command produces no output. | |
40 | ||
41 | For more information about using asymmetric CMKs in AWS KMS, see `Using Symmetric and Asymmetric Keys <https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html>`__ in the *AWS Key Management Service API Reference*. | |
42 | ||
43 | **Example 3: To download the public key of an asymmetric CMK** | |
44 | ||
45 | The following ``get-public-key`` example downloads the public key of an asymmetric CMK. | |
46 | ||
47 | In addition to returning the public key, the output includes information that you need to use the public key safely outside of AWS KMS, including the key usage and supported encryption algorithms. | |
48 | ||
49 | Before running this command, replace the example key ID with a valid key ID from your AWS account. :: | |
50 | ||
51 | aws kms get-public-key \ | |
52 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab | |
53 | ||
54 | Output:: | |
55 | ||
56 | { | |
57 | "KeyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", | |
58 | "PublicKey": "jANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAl5epvg1/QtJhxSi2g9SDEVg8QV/...", | |
59 | "CustomerMasterKeySpec": "RSA_4096", | |
60 | "KeyUsage": "ENCRYPT_DECRYPT", | |
61 | "EncryptionAlgorithms": [ | |
62 | "RSAES_OAEP_SHA_1", | |
63 | "RSAES_OAEP_SHA_256" | |
64 | ] | |
65 | } | |
66 | ||
67 | For more information about using asymmetric CMKs in AWS KMS, see `Using Symmetric and Asymmetric Keys <https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html>`__ in the *AWS Key Management Service API Reference*. | |
68 | ||
69 | **Example 4: To convert a public key to DER format (Linux and macOS)** | |
70 | ||
71 | The following ``get-public-key`` example downloads the public key of an asymmetric CMK and saves it in a DER file. | |
72 | ||
73 | When you use the ``get-public-key`` command in the AWS CLI, it returns a DER-encoded X.509 public key that is Base64-encoded. This example gets the value of the PublicKey property as text. It Base64-decodes the ``PublicKey`` and saves it in the ``public_key.der`` file. The ``output`` parameter returns the output as text, instead of JSON. The ``--query`` parameter gets only the ``PublicKey`` property, not the properties that you need to use the public key safely outside of AWS KMS. | |
74 | ||
75 | Before running this command, replace the example key ID with a valid key ID from your AWS account. :: | |
76 | ||
77 | aws kms get-public-key \ | |
78 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ | |
79 | --output text \ | |
80 | --query PublicKey | base64 --decode > public_key.der | |
81 | ||
82 | This command produces no output. | |
83 | ||
84 | For more information about using asymmetric CMKs in AWS KMS, see `Using Symmetric and Asymmetric Keys <https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html>`__ in the *AWS Key Management Service API Reference*.⏎ |
0 | **To import key material into a KMS customer master key** | |
1 | ||
2 | The following ``import-key-material`` example uploads key material into a CMK that was created with no key material. The key state of the CMK must be ``PendingImport``. | |
3 | ||
4 | This command uses key material that you encrypted with the public key that the ``get-parameters-for-import`` command returned. It also uses the import token from the same ``get-parameters-for-import`` command. | |
5 | ||
6 | The ``expiration-model`` parameter indicates that the key material automatically expires on the date and time specified by the ``valid-to`` parameter. When the key material expires, AWS KMS deletes the key material, the key state of the CMK changes to ``Pending import`` and the CMK becomes unusable. To restore the CMK, you must reimport the same key material. To use different key material, you must create a new CMK. | |
7 | ||
8 | Before running this command, replace the example key ID with a valid key ID or key ARN from your AWS account. :: | |
9 | ||
10 | aws kms import-key-material \ | |
11 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ | |
12 | --encrypted-key-material fileb://EncryptedKeyMaterial.bin \ | |
13 | --import-token fileb://ImportToken.bin \ | |
14 | --expiration-model KEY_MATERIAL_EXPIRES \ | |
15 | --valid-to 2021-09-21T19:00:00Z | |
16 | ||
17 | This command produces no output. | |
18 | ||
19 | For more information about importing key material, see `Importing Key Material <https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **To get the names of key policies for a CMK** | |
1 | ||
2 | The following ``list-key-policies`` example gets the names of the key policies for a customer managed CMK in the example account and Region. You can use this command to find the names of key policies for AWS managed CMKs and customer managed CMKs. | |
3 | ||
4 | Because the only valid key policy name is ``default``, this command is not useful. | |
5 | ||
6 | To specify the CMK, use the ``key-id`` parameter. This example uses a key ID value, but you can use a key ID or key ARN in this command. :: | |
7 | ||
8 | aws kms list-key-policies \ | |
9 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab | |
10 | ||
11 | Output:: | |
12 | ||
13 | { | |
14 | "PolicyNames": [ | |
15 | "default" | |
16 | ] | |
17 | } | |
18 | ||
19 | For more information about AWS KMS key policies, see `Using Key Policies in AWS KMS <https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **To get the customer master keys (CMKs) in an account and Region** | |
1 | ||
2 | The following ``list-keys`` example gets the CMKs in an account and Region. This command returns both AWS managed CMKs and customer managed CMKs. :: | |
3 | ||
4 | aws kms list-keys | |
5 | ||
6 | Output:: | |
7 | ||
8 | { | |
9 | "Keys": [ | |
10 | { | |
11 | "KeyArn": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", | |
12 | "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab" | |
13 | }, | |
14 | { | |
15 | "KeyArn": "arn:aws:kms:us-west-2:111122223333:key/0987dcba-09fe-87dc-65ba-ab0987654321", | |
16 | "KeyId": "0987dcba-09fe-87dc-65ba-ab0987654321" | |
17 | }, | |
18 | { | |
19 | "KeyArn": "arn:aws:kms:us-east-2:111122223333:key/1a2b3c4d-5e6f-1a2b-3c4d-5e6f1a2b3c4d", | |
20 | "KeyId": "1a2b3c4d-5e6f-1a2b-3c4d-5e6f1a2b3c4d" | |
21 | } | |
22 | ] | |
23 | } | |
24 | ||
25 | For more information, see `Viewing Keys <https://docs.aws.amazon.com/kms/latest/developerguide/viewing-keys.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **To get the tags on an AWS KMS CMK** | |
1 | ||
2 | The following ``list-resource-tags`` example gets the tags for a CMK. To add or replace resource tags on CMKs, use the ``tag-resource`` command. The output shows that this CMK has two resource tags, each of which is comprised of a key and value. | |
3 | ||
4 | To specify the CMK, use the ``key-id`` parameter. This example uses a key ID value, but you can use a key ID or key ARN in this command. :: | |
5 | ||
6 | aws kms list-resource-tags \ | |
7 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab | |
8 | ||
9 | Output:: | |
10 | ||
11 | { | |
12 | "Tags": [ | |
13 | { | |
14 | "TagKey": "Dept", | |
15 | "TagValue": "IT" | |
16 | }, | |
17 | { | |
18 | "TagKey": "Purpose", | |
19 | "TagValue": "Test" | |
20 | } | |
21 | ], | |
22 | "Truncated": false | |
23 | } | |
24 | ||
25 | For more information about using tags in AWS KMS, see `Tagging Keys <https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **To view the grants that a principal can retire** | |
1 | ||
2 | The following ``list-retirable-grants`` example displays all of the grants that the ``ExampleAdmin`` user can retire on the customer master keys (CMKs) in an AWS account and Region. You can use a command like this one to view the grants that any account principal can retire on CMKs in the AWS account and Region. | |
3 | ||
4 | The value of the required ``retiring-principal`` parameter must be the Amazon Resource Name (ARN) of an account, user, or role. | |
5 | ||
6 | You cannot specify a service for the value of ``retiring-principal`` in this command, even though a service can be the retiring principal. To find the grants in which a particular service is the retiring principal, use the ``list-grants`` command. | |
7 | ||
8 | The output shows that ``ExampleAdmin`` user has permission to retire grants on two different CMKs in the account and region. In addition to the retiring principal, the account (root) has permission to retire any grant in the account. :: | |
9 | ||
10 | aws kms list-retirable-grants \ | |
11 | --retiring-principal arn:aws:iam::111122223333:user/ExampleAdmin | |
12 | ||
13 | Output:: | |
14 | ||
15 | { | |
16 | "Grants": [ | |
17 | { | |
18 | "KeyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", | |
19 | "GrantId": "156b69c63cb154aa21f59929ff19760717be8d9d82b99df53e18b94a15a5e88e", | |
20 | "Name": "", | |
21 | "CreationDate": 1576800734.0, | |
22 | "GranteePrincipal": "arn:aws:iam::111122223333:user/ExampleUser", | |
23 | "RetiringPrincipal": "arn:aws:iam::111122223333:user/ExampleAdmin", | |
24 | "IssuingAccount": "arn:aws:iam::111122223333:root", | |
25 | "Operations": [ | |
26 | "Encrypt" | |
27 | ], | |
28 | "Constraints": { | |
29 | "EncryptionContextSubset": { | |
30 | "Department": "IT" | |
31 | } | |
32 | } | |
33 | }, | |
34 | { | |
35 | "KeyId": "arn:aws:kms:us-west-2:111122223333:key/0987dcba-09fe-87dc-65ba-ab0987654321", | |
36 | "GrantId": "8c94d1f12f5e69f440bae30eaec9570bb1fb7358824f9ddfa1aa5a0dab1a59b2", | |
37 | "Name": "", | |
38 | "CreationDate": 1568565290.0, | |
39 | "GranteePrincipal": "arn:aws:iam::111122223333:role/ExampleRole", | |
40 | "RetiringPrincipal": "arn:aws:iam::111122223333:user/ExampleAdmin", | |
41 | "IssuingAccount": "arn:aws:iam::111122223333:root", | |
42 | "Operations": [ | |
43 | "Decrypt" | |
44 | ], | |
45 | "Constraints": { | |
46 | "EncryptionContextSubset": { | |
47 | "Department": "IT" | |
48 | } | |
49 | } | |
50 | } | |
51 | ], | |
52 | "Truncated": false | |
53 | } | |
54 | ||
55 | For more information, see `Using Grants <https://docs.aws.amazon.com/kms/latest/developerguide/grants.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **To retire a grant on a customer master key** | |
1 | ||
2 | The following ``retire-grant`` example deletes a grant from a CMK. | |
3 | ||
4 | The following example command specifies the ``grant-id`` and the ``key-id`` parameters. The value of the ``key-id`` parameter must be the Amazon Resource Name (ARN) of the CMK. :: | |
5 | ||
6 | aws kms retire-grant \ | |
7 | --grant-id 1234a2345b8a4e350500d432bccf8ecd6506710e1391880c4f7f7140160c9af3 \ | |
8 | --key-id arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab | |
9 | ||
10 | This command produces no output. To confirm that the grant was retired, use the ``list-grants`` command. | |
11 | ||
12 | For more information, see `Using Grants <https://docs.aws.amazon.com/kms/latest/developerguide/grants.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **To revoke a grant on a customer master key** | |
1 | ||
2 | The following ``revoke-grant`` example deletes a grant from a CMK. The following example command specifies the ``grant-id`` and the ``key-id`` parameters. The value of the ``key-id`` parameter can be the key ID or the Amazon Resource Name (ARN) of the CMK. :: | |
3 | ||
4 | aws kms revoke-grant \ | |
5 | --grant-id 1234a2345b8a4e350500d432bccf8ecd6506710e1391880c4f7f7140160c9af3 \ | |
6 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab | |
7 | ||
8 | This command produces no output. To confirm that the grant was revoked, use the ``list-grants`` command. | |
9 | ||
10 | For more information, see `Using Grants <https://docs.aws.amazon.com/kms/latest/developerguide/grants.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **Example 1: To generate a digital signature for a message** | |
1 | ||
2 | The following ``sign`` example generates a cryptographic signature for a short message. The output of the command includes a base-64 encoded ``Signature`` field that you can verify by using the ``verify`` command. | |
3 | ||
4 | You must also specify a signing algorithm that your CMK supports. To get the signing algorithms for your CMK, use the ``describe-key`` command. | |
5 | ||
6 | Before running this command, replace the example key ID with a valid key ID from your AWS account. The key ID must represent an asymmetric CMK with a key usage of SIGN_VERIFY. :: | |
7 | ||
8 | aws kms sign \ | |
9 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ | |
10 | --message 'hello world' \ | |
11 | --message-type RAW \ | |
12 | --signing-algorithm RSASSA_PKCS1_V1_5_SHA_256 | |
13 | ||
14 | Output:: | |
15 | ||
16 | { | |
17 | "KeyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", | |
18 | "Signature": "ABCDEFhpyVYyTxbafE74ccSvEJLJr3zuoV1Hfymz4qv+/fxmxNLA7SE1SiF8lHw80fKZZ3bJ...", | |
19 | "SigningAlgorithm": "RSASSA_PKCS1_V1_5_SHA_256" | |
20 | } | |
21 | ||
22 | For more information about using asymmetric CMKs in AWS KMS, see `Using Symmetric and Asymmetric Keys<https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html>`__ in the *AWS Key Management Service API Reference*. | |
23 | ||
24 | **Example 2: To save a digital signature in a file (Linux and macOs)** | |
25 | ||
26 | The following ``sign`` example generates a cryptographic signature for a short message stored in a local file. The command also gets the Signature property from the response, Base64-decodes it and saves it in the ExampleSignature file. You can use the signature file in a ``verify`` command that verifies the signature. | |
27 | ||
28 | The ``sign`` command requires a signing algorithm. To get the signing algorithms that your CMK supports, use the ``describe-key`` command. | |
29 | ||
30 | Before running this command, replace the example key ID with a valid key ID from your AWS account. The key ID must represent an asymmetric CMK with a key usage of SIGN_VERIFY. :: | |
31 | ||
32 | aws kms sign \ | |
33 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ | |
34 | --message fileb://originalString \ | |
35 | --message-type RAW \ | |
36 | --signing-algorithm RSASSA_PKCS1_V1_5_SHA_256 \ | |
37 | --output text \ | |
38 | --query Signature | base64 --decode > ExampleSignature | |
39 | ||
40 | This command produces no output. This example extracts the ``Signature`` property of the output and saves it in a file. | |
41 | ||
42 | For more information about using asymmetric CMKs in AWS KMS, see `Using Symmetric and Asymmetric Keys <https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html>`__ in the *AWS Key Management Service API Reference*.⏎ |
0 | **To add a tag to an AWS KMS CMK** | |
1 | ||
2 | The following ``tag-resource`` example adds ``"Purpose":"Test"`` and ``"Dept":"IT"`` tags to a customer managed CMK. You can use tags like these to label CMKs and create categories of CMKs. | |
3 | ||
4 | To specify the CMK, use the ``key-id`` parameter. This example uses a key ID value, but you can use a key ID or key ARN in this command. | |
5 | ||
6 | Before running this command, replace the example key ID with a valid key ID from your AWS account. :: | |
7 | ||
8 | aws kms tag-resource \ | |
9 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ | |
10 | --tags TagKey='Purpose',TagValue='Test' TagKey='Dept',TagValue='IT' | |
11 | ||
12 | This command produces no output. To view the tags on an AWS KMS CMK, use the ``list-resource-tags`` command. | |
13 | ||
14 | For more information about using tags in AWS KMS, see `Tagging Keys <https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **To delete a tag from an AWS KMS CMK** | |
1 | ||
2 | The following ``untag-resource`` example deletes the tag with the ``"Purpose"`` key from a customer managed CMK. | |
3 | ||
4 | To specify the CMK, use the ``key-id`` parameter. This example uses a key ID value, but you can use a key ID or key ARN in this command. Before running this command, replace the example key ID with a valid key ID from your AWS account. :: | |
5 | ||
6 | aws kms untag-resource \ | |
7 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ | |
8 | --tag-key 'Purpose' | |
9 | ||
10 | This command produces no output. To view the tags on an AWS KMS CMK, use the ``list-resource-tags`` command. | |
11 | ||
12 | For more information about using tags in AWS KMS, see `Tagging Keys <https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html>`__ in the *AWS Key Management Service Developer Guide*.⏎ |
0 | **To verify a digital signature** | |
1 | ||
2 | The following ``verify`` example verifies a cryptographic signature for a short message. The key ID, message, message type, and signing algorithm must be same ones that were used to sign the message. The signature that you specify cannot be base64-encoded. For help decoding the signature that the ``sign`` command returns, see the ``sign`` command examples. | |
3 | ||
4 | The output of the command includes a Boolean ``SignatureValid`` field that indicates that the signature was verified. If the signature validation fails, the ``verify`` command fails, too. | |
5 | ||
6 | Before running this command, replace the example key ID with a valid key ID from your AWS account. :: | |
7 | ||
8 | aws kms verify \ | |
9 | --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ | |
10 | --message fileb://originalString \ | |
11 | --message-type RAW \ | |
12 | --signing-algorithm RSASSA_PKCS1_V1_5_SHA_256 \ | |
13 | --signature fileb://ExampleSignature | |
14 | ||
15 | Output:: | |
16 | ||
17 | { | |
18 | "KeyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", | |
19 | "SignatureValid": true, | |
20 | "SigningAlgorithm": "RSASSA_PKCS1_V1_5_SHA_256" | |
21 | } | |
22 | ||
23 | For more information about using asymmetric CMKs in AWS KMS, see `Using Symmetric and Asymmetric Keys <https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html>`__ in the *AWS Key Management Service API Reference*.⏎ |
0 | **To create a server** | |
1 | ||
2 | The following ``create-server`` example creates a new Chef Automate server named ``automate-06`` in your default region. Note that defaults are used for most other settings, such as number of backups to retain, and maintenance and backup start times. Before you run a ``create-server`` command, complete prerequisites in `Getting Started with AWS OpsWorks for Chef Automate <http://docs.aws.amazon.com/opsworks/latest/userguide/gettingstarted-opscm.html>`__ in the *AWS Opsworks for Chef Automate User Guide*. :: | |
3 | ||
4 | aws opsworks-cm create-server \ | |
5 | --engine "ChefAutomate" \ | |
6 | --instance-profile-arn "arn:aws:iam::012345678901:instance-profile/aws-opsworks-cm-ec2-role" \ | |
7 | --instance-type "t2.medium" \ | |
8 | --server-name "automate-06" \ | |
9 | --service-role-arn "arn:aws:iam::012345678901:role/aws-opsworks-cm-service-role" | |
10 | ||
11 | Output:: | |
12 | ||
13 | { | |
14 | "Server": { | |
15 | "AssociatePublicIpAddress": true, | |
16 | "BackupRetentionCount": 10, | |
17 | "CreatedAt": 2019-12-29T13:38:47.520Z, | |
18 | "DisableAutomatedBackup": FALSE, | |
19 | "Endpoint": "https://opsworks-cm.us-east-1.amazonaws.com", | |
20 | "Engine": "ChefAutomate", | |
21 | "EngineAttributes": [ | |
22 | { | |
23 | "Name": "CHEF_AUTOMATE_ADMIN_PASSWORD", | |
24 | "Value": "1Example1" | |
25 | } | |
26 | ], | |
27 | "EngineModel": "Single", | |
28 | "EngineVersion": "2019-08", | |
29 | "InstanceProfileArn": "arn:aws:iam::012345678901:instance-profile/aws-opsworks-cm-ec2-role", | |
30 | "InstanceType": "t2.medium", | |
31 | "PreferredBackupWindow": "Sun:02:00", | |
32 | "PreferredMaintenanceWindow": "00:00", | |
33 | "SecurityGroupIds": [ "sg-12345678" ], | |
34 | "ServerArn": "arn:aws:iam::012345678901:instance/automate-06-1010V4UU2WRM2", | |
35 | "ServerName": "automate-06", | |
36 | "ServiceRoleArn": "arn:aws:iam::012345678901:role/aws-opsworks-cm-service-role", | |
37 | "Status": "CREATING", | |
38 | "SubnetIds": [ "subnet-12345678" ] | |
39 | } | |
40 | } | |
41 | ||
42 | For more information, see `CreateServer <http://docs.aws.amazon.com/opsworks-cm/latest/APIReference/API_CreateServer.html>`__ in the *AWS OpsWorks for Chef Automate API Reference*.⏎ |
0 | **To associate an AWS Identity and Access Management (IAM) role with a DB instance** | |
1 | ||
2 | The following ``authorize-db-security-group-ingress`` example configures the default security group with an ingress rule for the CIDR IP range 192.0.2.0/24. :: | |
3 | ||
4 | aws rds authorize-db-security-group-ingress \ | |
5 | --db-security-group-name default \ | |
6 | --cidrip 192.0.2.0/24 | |
7 | ||
8 | Output:: | |
9 | ||
10 | { | |
11 | "DBSecurityGroup": { | |
12 | "OwnerId": "123456789012", | |
13 | "DBSecurityGroupName": "default", | |
14 | "DBSecurityGroupDescription": "default", | |
15 | "EC2SecurityGroups": [], | |
16 | "IPRanges": [ | |
17 | { | |
18 | "Status": "authorizing", | |
19 | "CIDRIP": "192.0.2.0/24" | |
20 | } | |
21 | ], | |
22 | "DBSecurityGroupArn": "arn:aws:rds:us-east-1:111122223333:secgrp:default" | |
23 | } | |
24 | } | |
25 | ||
26 | For more information, see `Authorizing Network Access to a DB Security Group from an IP Range <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithSecurityGroups.html#USER_WorkingWithSecurityGroups.Authorizing>`__ in the *Amazon RDS User Guide*. |
0 | **To describe snapshot export tasks** | |
1 | ||
2 | The following ``describe-export-tasks`` example returns information about snapshot exports to Amazon S3. :: | |
3 | ||
4 | aws rds describe-export-tasks | |
5 | ||
6 | Output:: | |
7 | ||
8 | { | |
9 | "ExportTasks": [ | |
10 | { | |
11 | "ExportTaskIdentifier": "test-snapshot-export", | |
12 | "SourceArn": "arn:aws:rds:us-west-2:123456789012:snapshot:test-snapshot", | |
13 | "SnapshotTime": "2020-03-02T18:26:28.163Z", | |
14 | "TaskStartTime": "2020-03-02T18:57:56.896Z", | |
15 | "TaskEndTime": "2020-03-02T19:10:31.985Z", | |
16 | "S3Bucket": "mybucket", | |
17 | "S3Prefix": "", | |
18 | "IamRoleArn": "arn:aws:iam::123456789012:role/service-role/ExportRole", | |
19 | "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/abcd0000-7fca-4128-82f2-aabbccddeeff", | |
20 | "Status": "COMPLETE", | |
21 | "PercentProgress": 100, | |
22 | "TotalExtractedDataInGB": 0 | |
23 | }, | |
24 | { | |
25 | "ExportTaskIdentifier": "my-s3-export", | |
26 | "SourceArn": "arn:aws:rds:us-west-2:123456789012:snapshot:db5-snapshot-test", | |
27 | "SnapshotTime": "2020-03-27T20:48:42.023Z", | |
28 | "S3Bucket": "mybucket", | |
29 | "S3Prefix": "", | |
30 | "IamRoleArn": "arn:aws:iam::123456789012:role/service-role/ExportRole", | |
31 | "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/abcd0000-7fca-4128-82f2-aabbccddeeff", | |
32 | "Status": "STARTING", | |
33 | "PercentProgress": 0, | |
34 | "TotalExtractedDataInGB": 0 | |
35 | } | |
36 | ] | |
37 | } | |
38 | ||
39 | For more information, see `Monitoring Snapshot Exports <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ExportSnapshot.html#USER_ExportSnapshot.Monitoring>`__ in the *Amazon RDS User Guide*. |
0 | **To modify a DB subnet group** | |
1 | ||
2 | The following ``modify-db-subnet-group`` example adds a subnet with the ID ``subnet-08e41f9e230222222`` to the DB subnet group named ``mysubnetgroup``. To keep the existing subnets in the subnet group, include their IDs as values in the ``--subnet-ids`` option. Make sure to have subnets with at least two different Availability Zones in the DB subnet group. :: | |
3 | ||
4 | aws rds modify-db-subnet-group \ | |
5 | --db-subnet-group-name mysubnetgroup \ | |
6 | --subnet-ids '["subnet-0a1dc4e1a6f123456","subnet-070dd7ecb3aaaaaaa","subnet-00f5b198bc0abcdef","subnet-08e41f9e230222222"]' | |
7 | ||
8 | Output:: | |
9 | ||
10 | { | |
11 | "DBSubnetGroup": { | |
12 | "DBSubnetGroupName": "mysubnetgroup", | |
13 | "DBSubnetGroupDescription": "test DB subnet group", | |
14 | "VpcId": "vpc-0f08e7610a1b2c3d4", | |
15 | "SubnetGroupStatus": "Complete", | |
16 | "Subnets": [ | |
17 | { | |
18 | "SubnetIdentifier": "subnet-08e41f9e230222222", | |
19 | "SubnetAvailabilityZone": { | |
20 | "Name": "us-west-2a" | |
21 | }, | |
22 | "SubnetStatus": "Active" | |
23 | }, | |
24 | { | |
25 | "SubnetIdentifier": "subnet-070dd7ecb3aaaaaaa", | |
26 | "SubnetAvailabilityZone": { | |
27 | "Name": "us-west-2b" | |
28 | }, | |
29 | "SubnetStatus": "Active" | |
30 | }, | |
31 | { | |
32 | "SubnetIdentifier": "subnet-00f5b198bc0abcdef", | |
33 | "SubnetAvailabilityZone": { | |
34 | "Name": "us-west-2d" | |
35 | }, | |
36 | "SubnetStatus": "Active" | |
37 | }, | |
38 | { | |
39 | "SubnetIdentifier": "subnet-0a1dc4e1a6f123456", | |
40 | "SubnetAvailabilityZone": { | |
41 | "Name": "us-west-2b" | |
42 | }, | |
43 | "SubnetStatus": "Active" | |
44 | } | |
45 | ], | |
46 | "DBSubnetGroupArn": "arn:aws:rds:us-west-2:534026745191:subgrp:mysubnetgroup" | |
47 | } | |
48 | } | |
49 | ||
50 | For more information, see `Step 3: Create a DB Subnet Group <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html#USER_VPC.CreateDBSubnetGroup>`__ in the *Amazon RDS User Guide*. |
0 | **Example 1: To find a reserved DB instance to purchase** | |
1 | ||
2 | The following ``describe-reserved-db-instances-offerings`` example lists the available reserved MySQL DB instances with the db.t2.micro instance class and a duration of one year. The offering ID is required for purchasing a reserved DB instance. :: | |
3 | ||
4 | aws rds describe-reserved-db-instances-offerings \ | |
5 | --product-description mysql \ | |
6 | --db-instance-class db.t2.micro \ | |
7 | --duration 1 | |
8 | ||
9 | Output:: | |
10 | ||
11 | { | |
12 | "ReservedDBInstancesOfferings": [ | |
13 | { | |
14 | "ReservedDBInstancesOfferingId": "8ba30be1-b9ec-447f-8f23-6114e3f4c7b4", | |
15 | "DBInstanceClass": "db.t2.micro", | |
16 | "Duration": 31536000, | |
17 | "FixedPrice": 51.0, | |
18 | "UsagePrice": 0.0, | |
19 | "CurrencyCode": "USD", | |
20 | "ProductDescription": "mysql", | |
21 | "OfferingType": "Partial Upfront", | |
22 | "MultiAZ": false, | |
23 | "RecurringCharges": [ | |
24 | { | |
25 | "RecurringChargeAmount": 0.006, | |
26 | "RecurringChargeFrequency": "Hourly" | |
27 | } | |
28 | ] | |
29 | }, | |
30 | ... some output truncated ... | |
31 | ] | |
32 | } | |
33 | ||
34 | For more information, see `Reserved DB Instances for Amazon RDS <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithReservedDBInstances.html>`__ in the *Amazon RDS User Guide*. | |
35 | ||
36 | **Example 2: To purchase a reserved DB instance** | |
37 | ||
38 | The following ``purchase-reserved-db-instances-offering`` example shows how to buy the reserved DB instance offering from the previous example. | |
39 | ||
40 | aws rds purchase-reserved-db-instances-offering \ | |
41 | --reserved-db-instances-offering-id 8ba30be1-b9ec-447f-8f23-6114e3f4c7b4 | |
42 | ||
43 | Output:: | |
44 | ||
45 | { | |
46 | "ReservedDBInstance": { | |
47 | "ReservedDBInstanceId": "ri-2020-06-29-16-54-57-670", | |
48 | "ReservedDBInstancesOfferingId": "8ba30be1-b9ec-447f-8f23-6114e3f4c7b4", | |
49 | "DBInstanceClass": "db.t2.micro", | |
50 | "StartTime": "2020-06-29T16:54:57.670Z", | |
51 | "Duration": 31536000, | |
52 | "FixedPrice": 51.0, | |
53 | "UsagePrice": 0.0, | |
54 | "CurrencyCode": "USD", | |
55 | "DBInstanceCount": 1, | |
56 | "ProductDescription": "mysql", | |
57 | "OfferingType": "Partial Upfront", | |
58 | "MultiAZ": false, | |
59 | "State": "payment-pending", | |
60 | "RecurringCharges": [ | |
61 | { | |
62 | "RecurringChargeAmount": 0.006, | |
63 | "RecurringChargeFrequency": "Hourly" | |
64 | } | |
65 | ], | |
66 | "ReservedDBInstanceArn": "arn:aws:rds:us-west-2:123456789012:ri:ri-2020-06-29-16-54-57-670" | |
67 | } | |
68 | } | |
69 | ||
70 | For more information, see `Reserved DB Instances for Amazon RDS <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithReservedDBInstances.html>`__ in the *Amazon RDS User Guide*.⏎ |
0 | **To export a snapshot to Amazon S3** | |
1 | ||
2 | The following ``start-export-task`` example exports a DB snapshot named ``db5-snapshot-test`` to the Amazon S3 bucket named ``mybucket``. :: | |
3 | ||
4 | aws rds start-export-task \ | |
5 | --export-task-identifier my-s3-export \ | |
6 | --source-arn arn:aws:rds:us-west-2:123456789012:snapshot:db5-snapshot-test \ | |
7 | --s3-bucket-name mybucket \ | |
8 | --iam-role-arn arn:aws:iam::123456789012:role/service-role/ExportRole \ | |
9 | --kms-key-id arn:aws:kms:us-west-2:123456789012:key/abcd0000-7fca-4128-82f2-aabbccddeeff | |
10 | ||
11 | Output:: | |
12 | ||
13 | { | |
14 | "ExportTaskIdentifier": "my-s3-export", | |
15 | "SourceArn": "arn:aws:rds:us-west-2:123456789012:snapshot:db5-snapshot-test", | |
16 | "SnapshotTime": "2020-03-27T20:48:42.023Z", | |
17 | "S3Bucket": "mybucket", | |
18 | "IamRoleArn": "arn:aws:iam::123456789012:role/service-role/ExportRole", | |
19 | "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/abcd0000-7fca-4128-82f2-aabbccddeeff", | |
20 | "Status": "STARTING", | |
21 | "PercentProgress": 0, | |
22 | "TotalExtractedDataInGB": 0 | |
23 | } | |
24 | ||
25 | For more information, see `Exporting a Snapshot to an Amazon S3 Bucket <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ExportSnapshot.html#USER_ExportSnapshot.Exporting>`__ in the *Amazon RDS User Guide*. |
0 | **To stop a cluster** | |
1 | ||
2 | The following ``stop-cluster`` example stops an Amazon Aurora DB cluster. :: | |
3 | ||
4 | aws rds stop-db-cluster \ | |
5 | --db-cluster-identifier mycluster | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "DBCluster": { | |
11 | "AllocatedStorage": 1, | |
12 | "AvailabilityZones": [ | |
13 | "us-east-1a", | |
14 | "us-east-1b", | |
15 | "us-east-1c" | |
16 | ], | |
17 | "BackupRetentionPeriod": 7, | |
18 | "DatabaseName": "", | |
19 | "DBClusterIdentifier": "mycluster", | |
20 | "DBClusterParameterGroup": "default.aurora-postgresql11", | |
21 | "DBSubnetGroup": "default", | |
22 | "Status": "available", | |
23 | "EarliestRestorableTime": "2020-07-01T06:17:10.807000+00:00", | |
24 | "Endpoint": "mycluster.cluster-cdgmuqiadpid.us-east-1.rds.amazonaws.com", | |
25 | "ReaderEndpoint": "mycluster.cluster-ro-cdgmuqiadpid.us-east-1.rds.amazonaws.com", | |
26 | "MultiAZ": true, | |
27 | "Engine": "aurora-postgresql", | |
28 | "EngineVersion": "11.6", | |
29 | "LatestRestorableTime": "2020-07-09T02:31:09.588000+00:00", | |
30 | "Port": 5432, | |
31 | "MasterUsername": "master", | |
32 | "PreferredBackupWindow": "06:11-06:41", | |
33 | "PreferredMaintenanceWindow": "mon:08:52-mon:09:22", | |
34 | "ReadReplicaIdentifiers": [], | |
35 | ||
36 | <remaining output omitted> | |
37 | ||
38 | } | |
39 | } | |
40 | ||
41 | For more information, see `Stopping and Starting an Amazon Aurora DB Cluster <https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-cluster-stop-start.html>`__ in the *Amazon Aurora User Guide*. |
0 | **Example 1: To return findings generated for a specific standard** | |
0 | **To return findings generated for a specific standard** | |
1 | 1 | |
2 | 2 | The following ``get-findings`` example returns findings for the PCI DSS standard. :: |
3 | 3 | |
4 | 4 | aws securityhub get-findings \ |
5 | --filters '{"GeneratorId":[{"Value": "pci-dss","Comparison":"PREFIX"}]}' \ | |
5 | --filters '{"GeneratorId":[{"Value": "pci-dss","Comparison":"PREFIX"}]}' | |
6 | 6 | --max-items 1 |
7 | 7 | |
8 | 8 | Output:: |
75 | 75 | "NextToken": "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAxfQ==" |
76 | 76 | } |
77 | 77 | |
78 | **Example 2: To return critical-severity findings that have a workflow status of NOTIFIED** | |
78 | ** To return critical-severity findings that have a workflow status of NOTIFIED ** | |
79 | 79 | |
80 | The following ``get-findings`` example returns findings that have a severity label value of CRITICAL and a workflow status of NOTIFIED. The results are sorted in descending order by the value of Confidence. | |
80 | The following ``get-findings`` example returns findings that have a severity label value of CRITICAL and a workflow status of NOTIFIED. The results are sorted in descending order by the value of Confidence. :: | |
81 | 81 | |
82 | 82 | aws securityhub get-findings \ |
83 | 83 | --filters '{"SeverityLabel":[{"Value": "CRITICAL","Comparison":"EQUALS"}],"WorkflowStatus": [{"Value":"NOTIFIED","Comparison":"EQUALS"}]}' \ |
0 | **To list file shares** | |
1 | ||
2 | The following ``command-name`` example lists the available widgets in your AWS account. :: | |
3 | ||
4 | aws storagegateway list-file-shares \ | |
5 | --gateway-arn arn:aws:storagegateway:us-east-1:209870788375:gateway/sgw-FB02E292 | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "FileShareInfoList": [ | |
11 | { | |
12 | "FileShareType": "NFS", | |
13 | "FileShareARN": "arn:aws:storagegateway:us-east-1:111122223333:share/share-2FA12345", | |
14 | "FileShareId": "share-2FA12345", | |
15 | "FileShareStatus": "AVAILABLE", | |
16 | "GatewayARN": "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-FB0AAAAA" | |
17 | } | |
18 | ], | |
19 | "Marker": null | |
20 | } | |
21 | ||
22 | For more information, see `ListFileShares <https://docs.aws.amazon.com/storagegateway/latest/APIReference/API_ListFileShares.html>`__ in the *AWS Storage Gateway Service API Reference*. |
0 | **To refresh the file share cache** | |
1 | ||
2 | The following ``refresh-cache`` example refreshes the cache for the specified file share. :: | |
3 | ||
4 | aws storagegateway refresh-cache \ | |
5 | --file-share-arn arn:aws:storagegateway:us-east-1:111122223333:share/share-2FA12345 | |
6 | ||
7 | Output:: | |
8 | ||
9 | { | |
10 | "FileShareARN": "arn:aws:storagegateway:us-east-1:111122223333:share/share-2FA12345", | |
11 | "NotificationId": "4954d4b1-abcd-ef01-1234-97950a7d3483" | |
12 | } | |
13 | ||
14 | For more information, see `ListFileShares <https://docs.aws.amazon.com/storagegateway/latest/APIReference/API_RefreshCache.html>`__ in the *AWS Storage Gateway Service API Reference*. |
0 | 0 | Metadata-Version: 1.1 |
1 | 1 | Name: awscli |
2 | Version: 1.18.99 | |
2 | Version: 1.18.111 | |
3 | 3 | Summary: Universal Command Line Environment for AWS. |
4 | 4 | Home-page: http://aws.amazon.com/cli/ |
5 | 5 | Author: Amazon Web Services |
6 | 6 | Author-email: UNKNOWN |
7 | 7 | License: Apache License 2.0 |
8 | Description: ======= | |
9 | aws-cli | |
10 | ======= | |
11 | ||
12 | .. image:: https://travis-ci.org/aws/aws-cli.svg?branch=develop | |
13 | :target: https://travis-ci.org/aws/aws-cli | |
14 | :alt: Build Status | |
15 | ||
16 | .. image:: https://badges.gitter.im/aws/aws-cli.svg | |
17 | :target: https://gitter.im/aws/aws-cli | |
18 | :alt: Gitter | |
19 | ||
8 | Description: # aws-cli | |
9 | ||
10 | [![Build Status](https://travis-ci.org/aws/aws-cli.svg?branch=develop)](https://travis-ci.org/aws/aws-cli) | |
11 | ||
12 | [![Gitter](https://badges.gitter.im/aws/aws-cli.svg)](https://gitter.im/aws/aws-cli) | |
20 | 13 | |
21 | 14 | This package provides a unified command line interface to Amazon Web Services. |
22 | 15 | |
16 | Jump to: | |
17 | ||
18 | - [Getting Started](#getting-started) | |
19 | - [Getting Help](#getting-help) | |
20 | - [More Resources](#more-resources) | |
21 | ||
22 | ## Getting Started | |
23 | ||
24 | This README is for the AWS CLI version 1. If you are looking for information about the AWS CLI version 2, please visit the [v2 branch](https://github.com/aws/aws-cli/tree/v2). | |
25 | ||
26 | ### Requirements | |
27 | ||
23 | 28 | The aws-cli package works on Python versions: |
24 | 29 | |
25 | * 2.7.x and greater | |
26 | * 3.4.x and greater | |
27 | * 3.5.x and greater | |
28 | * 3.6.x and greater | |
29 | * 3.7.x and greater | |
30 | * 3.8.x and greater | |
31 | ||
32 | On 10/09/2019 support for Python 2.6 and Python 3.3 was deprecated and support | |
33 | was dropped on 01/10/2020. To avoid disruption, customers using the AWS CLI | |
34 | on Python 2.6 or 3.3 will need to upgrade their version of Python or pin the | |
35 | version of the AWS CLI in use prior to 01/10/2020. For more information, see | |
36 | this `blog post <https://aws.amazon.com/blogs/developer/deprecation-of-python-2-6-and-python-3-3-in-botocore-boto3-and-the-aws-cli/>`__. | |
37 | ||
38 | ||
39 | .. attention:: | |
40 | We recommend that all customers regularly monitor the | |
41 | `Amazon Web Services Security Bulletins website`_ for any important security bulletins related to | |
42 | aws-cli. | |
43 | ||
44 | ||
45 | ------------ | |
46 | Installation | |
47 | ------------ | |
48 | ||
49 | The easiest way to install aws-cli is to use `pip`_ in a ``virtualenv``:: | |
30 | - 2.7.x and greater | |
31 | - 3.4.x and greater | |
32 | - 3.5.x and greater | |
33 | - 3.6.x and greater | |
34 | - 3.7.x and greater | |
35 | - 3.8.x and greater | |
36 | ||
37 | On 10/09/2019 support for Python 2.6 and Python 3.3 was deprecated and support was dropped on 01/10/2020. To avoid disruption, customers using the AWS CLI on Python 2.6 or 3.3 will need to upgrade their version of Python or pin the version of the AWS CLI in use prior to 01/10/2020. For more information, see this [blog post](https://aws.amazon.com/blogs/developer/deprecation-of-python-2-6-and-python-3-3-in-botocore-boto3-and-the-aws-cli/). | |
38 | ||
39 | *Attention!* | |
40 | ||
41 | *We recommend that all customers regularly monitor the [Amazon Web Services Security Bulletins website](https://aws.amazon.com/security/security-bulletins) for any important security bulletins related to aws-cli.* | |
42 | ||
43 | ### Installation | |
44 | ||
45 | The safest way to install the AWS CLI is to use [pip](https://pip.pypa.io/en/stable/) in a `virtualenv`: | |
50 | 46 | |
51 | 47 | $ python -m pip install awscli |
52 | 48 | |
53 | or, if you are not installing in a ``virtualenv``, to install globally:: | |
49 | or, if you are not installing in a `virtualenv`, to install globally: | |
54 | 50 | |
55 | 51 | $ sudo python -m pip install awscli |
56 | 52 | |
57 | or for your user:: | |
53 | or for your user: | |
58 | 54 | |
59 | 55 | $ python -m pip install --user awscli |
60 | 56 | |
61 | If you have the aws-cli installed and want to upgrade to the latest version | |
62 | you can run:: | |
57 | If you have the aws-cli package installed and want to upgrade to the latest version you can run: | |
63 | 58 | |
64 | 59 | $ python -m pip install --upgrade awscli |
65 | 60 | |
66 | .. note:: | |
67 | ||
68 | On macOS, if you see an error regarding the version of six that came with | |
69 | distutils in El Capitan, use the ``--ignore-installed`` option:: | |
70 | ||
71 | $ sudo python -m pip install awscli --ignore-installed six | |
72 | ||
73 | ||
74 | This will install the aws-cli package as well as all dependencies. You can | |
75 | also just `download the tarball`_. Once you have the | |
76 | awscli directory structure on your workstation, you can just run:: | |
77 | ||
78 | $ cd <path_to_awscli> | |
79 | $ python setup.py install | |
80 | ||
81 | If you want to run the ``develop`` branch of the CLI, see the | |
82 | "CLI Dev Version" section below. | |
83 | ||
84 | ||
85 | ------------ | |
86 | CLI Releases | |
87 | ------------ | |
88 | ||
89 | The release notes for the AWS CLI can be found `here <https://github.com/aws/aws-cli/blob/develop/CHANGELOG.rst>`__. | |
90 | ||
91 | ||
92 | ------------------ | |
93 | Command Completion | |
94 | ------------------ | |
95 | ||
96 | The aws-cli package includes a very useful command completion feature. | |
97 | This feature is not automatically installed so you need to configure it manually. | |
98 | To enable tab completion for bash either use the built-in command ``complete``:: | |
99 | ||
100 | $ complete -C aws_completer aws | |
101 | ||
102 | Or add ``bin/aws_bash_completer`` file under ``/etc/bash_completion.d``, | |
103 | ``/usr/local/etc/bash_completion.d`` or any other ``bash_completion.d`` location. | |
104 | ||
105 | For tcsh:: | |
106 | ||
107 | $ complete aws 'p/*/`aws_completer`/' | |
108 | ||
109 | You should add this to your startup scripts to enable it for future sessions. | |
110 | ||
111 | For zsh please refer to ``bin/aws_zsh_completer.sh``. Source that file, e.g. | |
112 | from your ``~/.zshrc``, and make sure you run ``compinit`` before:: | |
113 | ||
114 | $ source bin/aws_zsh_completer.sh | |
115 | ||
116 | For now the bash compatibility auto completion (``bashcompinit``) is used. | |
117 | For further details please refer to the top of ``bin/aws_zsh_completer.sh``. | |
118 | ||
119 | --------------- | |
120 | Getting Started | |
121 | --------------- | |
122 | ||
123 | Before using aws-cli, you need to tell it about your AWS credentials. You | |
124 | can do this in several ways: | |
125 | ||
126 | * Environment variables | |
127 | * Shared credentials file | |
128 | * Config file | |
129 | * IAM Role | |
130 | ||
131 | The quickest way to get started is to run the ``aws configure`` command:: | |
61 | This will install the aws-cli package as well as all dependencies. | |
62 | ||
63 | *Note* | |
64 | ||
65 | *On macOS, if you see an error regarding the version of `six` that came with `distutils` in El Capitan, use the `--ignore-installed` option:* | |
66 | ||
67 | $ sudo python -m pip install awscli --ignore-installed six | |
68 | ||
69 | On Linux and Mac OS, the AWS CLI can be installed using a [bundled installer](https://docs.aws.amazon.com/cli/latest/userguide/install-linux.html#install-linux-bundled). The AWS CLI can also be installed on Windows via an [MSI Installer](https://docs.aws.amazon.com/cli/latest/userguide/install-windows.html#msi-on-windows). | |
70 | ||
71 | If you want to run the `develop` branch of the AWS CLI, see the [Development Version](CONTRIBUTING.md#development-version) section of the contributing guide. | |
72 | ||
73 | See the [installation](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv1.html) section of the AWS CLI User Guide for more information. | |
74 | ||
75 | ### Configuration | |
76 | ||
77 | Before using the AWS CLI, you need to configure your AWS credentials. You can do this in several ways: | |
78 | ||
79 | - Configuration command | |
80 | - Environment variables | |
81 | - Shared credentials file | |
82 | - Config file | |
83 | - IAM Role | |
84 | ||
85 | The quickest way to get started is to run the `aws configure` command: | |
132 | 86 | |
133 | 87 | $ aws configure |
134 | AWS Access Key ID: foo | |
135 | AWS Secret Access Key: bar | |
88 | AWS Access Key ID: MYACCESSKEY | |
89 | AWS Secret Access Key: MYSECRETKEY | |
136 | 90 | Default region name [us-west-2]: us-west-2 |
137 | 91 | Default output format [None]: json |
138 | 92 | |
139 | To use environment variables, do the following:: | |
93 | To use environment variables, do the following: | |
140 | 94 | |
141 | 95 | $ export AWS_ACCESS_KEY_ID=<access_key> |
142 | 96 | $ export AWS_SECRET_ACCESS_KEY=<secret_key> |
143 | 97 | |
144 | To use the shared credentials file, create an INI formatted file like this:: | |
98 | To use the shared credentials file, create an INI formatted file like this: | |
145 | 99 | |
146 | 100 | [default] |
147 | aws_access_key_id=foo | |
148 | aws_secret_access_key=bar | |
101 | aws_access_key_id=MYACCESSKEY | |
102 | aws_secret_access_key=MYSECRETKEY | |
149 | 103 | |
150 | 104 | [testing] |
151 | aws_access_key_id=foo | |
152 | aws_secret_access_key=bar | |
153 | ||
154 | and place it in ``~/.aws/credentials`` (or in | |
155 | ``%UserProfile%\.aws/credentials`` on Windows). If you wish to place the | |
156 | shared credentials file in a different location than the one specified above, | |
157 | you need to tell aws-cli where to find it. Do this by setting | |
158 | the appropriate environment variable:: | |
105 | aws_access_key_id=MYACCESKEY | |
106 | aws_secret_access_key=MYSECRETKEY | |
107 | ||
108 | and place it in `~/.aws/credentials` (or in `%UserProfile%\.aws/credentials` on Windows). If you wish to place the shared credentials file in a different location than the one specified above, you need to tell aws-cli where to find it. Do this by setting the appropriate environment variable: | |
159 | 109 | |
160 | 110 | $ export AWS_SHARED_CREDENTIALS_FILE=/path/to/shared_credentials_file |
161 | 111 | |
162 | To use a config file, create a configuration file like this:: | |
112 | To use a config file, create an INI formatted file like this: | |
163 | 113 | |
164 | 114 | [default] |
165 | 115 | aws_access_key_id=<default access key> |
172 | 122 | aws_secret_access_key=<testing secret key> |
173 | 123 | region=us-west-2 |
174 | 124 | |
175 | and place it in ``~/.aws/config`` (or in ``%UserProfile%\.aws\config`` on Windows). If you wish to place the config file in a different location than the one | |
176 | specified above, you need to tell aws-cli where to find it. Do this by setting | |
177 | the appropriate environment variable:: | |
125 | and place it in `~/.aws/config` (or in `%UserProfile%\.aws\config` on Windows). If you wish to place the config file in a different location than the one specified above, you need to tell the AWS CLI where to find it. Do this by setting the appropriate environment variable: | |
178 | 126 | |
179 | 127 | $ export AWS_CONFIG_FILE=/path/to/config_file |
180 | 128 | |
181 | As you can see, you can have multiple ``profiles`` defined in both the shared | |
182 | credentials file and the configuration file. You can then specify which | |
183 | profile to use by using the ``--profile`` option. If no profile is specified | |
184 | the ``default`` profile is used. | |
185 | ||
186 | In the config file, except for the default profile, you | |
187 | **must** prefix each config section of a profile group with ``profile``. | |
188 | For example, if you have a profile named "testing" the section header would | |
189 | be ``[profile testing]``. | |
190 | ||
191 | The final option for credentials is highly recommended if you are | |
192 | using aws-cli on an EC2 instance. IAM Roles are | |
193 | a great way to have credentials installed automatically on your | |
194 | instance. If you are using IAM Roles, aws-cli will find them and use | |
195 | them automatically. | |
196 | ||
197 | ---------------------------- | |
198 | Other Configurable Variables | |
199 | ---------------------------- | |
200 | ||
201 | In addition to credentials, a number of other variables can be | |
202 | configured either with environment variables, configuration file | |
203 | entries or both. The following table documents these. | |
204 | ||
205 | ============================= =========== ============================= ================================= ================================== | |
206 | Variable Option Config Entry Environment Variable Description | |
207 | ============================= =========== ============================= ================================= ================================== | |
208 | profile --profile profile AWS_PROFILE Default profile name | |
209 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
210 | region --region region AWS_DEFAULT_REGION Default AWS Region | |
211 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
212 | config_file AWS_CONFIG_FILE Alternate location of config | |
213 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
214 | credentials_file AWS_SHARED_CREDENTIALS_FILE Alternate location of credentials | |
215 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
216 | output --output output AWS_DEFAULT_OUTPUT Default output style | |
217 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
218 | ca_bundle --ca-bundle ca_bundle AWS_CA_BUNDLE CA Certificate Bundle | |
219 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
220 | access_key aws_access_key_id AWS_ACCESS_KEY_ID AWS Access Key | |
221 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
222 | secret_key aws_secret_access_key AWS_SECRET_ACCESS_KEY AWS Secret Key | |
223 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
224 | token aws_session_token AWS_SESSION_TOKEN AWS Token (temp credentials) | |
225 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
226 | cli_timestamp_format cli_timestamp_format Output format of timestamps | |
227 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
228 | metadata_service_timeout metadata_service_timeout AWS_METADATA_SERVICE_TIMEOUT EC2 metadata timeout | |
229 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
230 | metadata_service_num_attempts metadata_service_num_attempts AWS_METADATA_SERVICE_NUM_ATTEMPTS EC2 metadata retry count | |
231 | ----------------------------- ----------- ----------------------------- --------------------------------- ---------------------------------- | |
232 | parameter_validation parameter_validation Toggles local parameter validation | |
233 | ============================= =========== ============================= ================================= ================================== | |
234 | ||
235 | ^^^^^^^^ | |
236 | Examples | |
237 | ^^^^^^^^ | |
238 | ||
239 | If you get tired of specifying a ``--region`` option on the command line | |
240 | all of the time, you can specify a default region to use whenever no | |
241 | explicit ``--region`` option is included using the ``region`` variable. | |
242 | To specify this using an environment variable:: | |
243 | ||
244 | $ export AWS_DEFAULT_REGION=us-west-2 | |
245 | ||
246 | To include it in your config file:: | |
247 | ||
248 | [default] | |
249 | aws_access_key_id=<default access key> | |
250 | aws_secret_access_key=<default secret key> | |
251 | region=us-west-1 | |
252 | ||
253 | Similarly, the ``profile`` variable can be used to specify which profile to use | |
254 | if one is not explicitly specified on the command line via the | |
255 | ``--profile`` option. To set this via environment variable:: | |
256 | ||
257 | $ export AWS_PROFILE=testing | |
258 | ||
259 | The ``profile`` variable can not be specified in the configuration file | |
260 | since it would have to be associated with a profile and would defeat the | |
261 | purpose. | |
262 | ||
263 | ^^^^^^^^^^^^^^^^^^^ | |
264 | Further Information | |
265 | ^^^^^^^^^^^^^^^^^^^ | |
266 | ||
267 | For more information about configuration options, please refer the | |
268 | `AWS CLI Configuration Variables topic <http://docs.aws.amazon.com/cli/latest/topic/config-vars.html#cli-aws-help-config-vars>`_. You can access this topic | |
269 | from the CLI as well by running ``aws help config-vars``. | |
270 | ||
271 | ||
272 | ---------------------------------------- | |
273 | Accessing Services With Global Endpoints | |
274 | ---------------------------------------- | |
275 | ||
276 | Some services, such as *AWS Identity and Access Management* (IAM) | |
277 | have a single, global endpoint rather than different endpoints for | |
278 | each region. | |
279 | ||
280 | To make access to these services simpler, aws-cli will automatically | |
281 | use the global endpoint unless you explicitly supply a region (using | |
282 | the ``--region`` option) or a profile (using the ``--profile`` option). | |
283 | Therefore, the following:: | |
284 | ||
285 | $ aws iam list-users | |
286 | ||
287 | will automatically use the global endpoint for the IAM service | |
288 | regardless of the value of the ``AWS_DEFAULT_REGION`` environment | |
289 | variable or the ``region`` variable specified in your profile. | |
290 | ||
291 | -------------------- | |
292 | JSON Parameter Input | |
293 | -------------------- | |
294 | ||
295 | Many options that need to be provided are simple string or numeric | |
296 | values. However, some operations require JSON data structures | |
297 | as input parameters either on the command line or in files. | |
298 | ||
299 | For example, consider the command to authorize access to an EC2 | |
300 | security group. In this case, we will add ingress access to port 22 | |
301 | for all IP addresses:: | |
302 | ||
303 | $ aws ec2 authorize-security-group-ingress --group-name MySecurityGroup \ | |
304 | --ip-permissions '{"FromPort":22,"ToPort":22,"IpProtocol":"tcp","IpRanges":[{"CidrIp": "0.0.0.0/0"}]}' | |
305 | ||
306 | -------------------------- | |
307 | File-based Parameter Input | |
308 | -------------------------- | |
309 | ||
310 | Some parameter values are so large or so complex that it would be easier | |
311 | to place the parameter value in a file and refer to that file rather than | |
312 | entering the value directly on the command line. | |
313 | ||
314 | Let's use the ``authorize-security-group-ingress`` command shown above. | |
315 | Rather than provide the value of the ``--ip-permissions`` parameter directly | |
316 | in the command, you could first store the values in a file. Let's call | |
317 | the file ``ip_perms.json``:: | |
318 | ||
319 | {"FromPort":22, | |
320 | "ToPort":22, | |
321 | "IpProtocol":"tcp", | |
322 | "IpRanges":[{"CidrIp":"0.0.0.0/0"}]} | |
323 | ||
324 | Then, we could make the same call as above like this:: | |
325 | ||
326 | $ aws ec2 authorize-security-group-ingress --group-name MySecurityGroup \ | |
327 | --ip-permissions file://ip_perms.json | |
328 | ||
329 | The ``file://`` prefix on the parameter value signals that the parameter value | |
330 | is actually a reference to a file that contains the actual parameter value. | |
331 | aws-cli will open the file, read the value and use that value as the | |
332 | parameter value. | |
333 | ||
334 | This is also useful when the parameter is really referring to file-based | |
335 | data. For example, the ``--user-data`` option of the ``aws ec2 run-instances`` | |
336 | command or the ``--public-key-material`` parameter of the | |
337 | ``aws ec2 import-key-pair`` command. | |
338 | ||
339 | ------------------------- | |
340 | URI-based Parameter Input | |
341 | ------------------------- | |
342 | ||
343 | Similar to the file-based input described above, aws-cli also includes a | |
344 | way to use data from a URI as the value of a parameter. The idea is exactly | |
345 | the same except the prefix used is ``https://`` or ``http://``:: | |
346 | ||
347 | $ aws ec2 authorize-security-group-ingress --group-name MySecurityGroup \ | |
348 | --ip-permissions http://mybucket.s3.amazonaws.com/ip_perms.json | |
349 | ||
350 | -------------- | |
351 | Command Output | |
352 | -------------- | |
353 | ||
354 | The default output for commands is currently JSON. You can use the | |
355 | ``--query`` option to extract the output elements from this JSON document. | |
356 | For more information on the expression language used for the ``--query`` | |
357 | argument, you can read the | |
358 | `JMESPath Tutorial <http://jmespath.org/tutorial.html>`__. | |
359 | ||
360 | ^^^^^^^^ | |
361 | Examples | |
362 | ^^^^^^^^ | |
363 | ||
364 | Get a list of IAM user names:: | |
365 | ||
366 | $ aws iam list-users --query Users[].UserName | |
367 | ||
368 | Get a list of key names and their sizes in an S3 bucket:: | |
369 | ||
370 | $ aws s3api list-objects --bucket b --query Contents[].[Key,Size] | |
371 | ||
372 | Get a list of all EC2 instances and include their Instance ID, State Name, | |
373 | and their Name (if they've been tagged with a Name):: | |
374 | ||
375 | $ aws ec2 describe-instances --query \ | |
376 | 'Reservations[].Instances[].[InstanceId,State.Name,Tags[?Key==`Name`] | [0].Value]' | |
377 | ||
378 | ||
379 | You may also find the `jq <http://stedolan.github.com/jq/>`_ tool useful in | |
380 | processing the JSON output for other uses. | |
381 | ||
382 | There is also an ASCII table format available. You can select this style with | |
383 | the ``--output table`` option or you can make this style your default output | |
384 | style via environment variable or config file entry as described above. | |
385 | Try adding ``--output table`` to the above commands. | |
386 | ||
387 | ||
388 | --------------- | |
389 | CLI Dev Version | |
390 | --------------- | |
391 | ||
392 | If you are just interested in using the latest released version of the AWS CLI, | |
393 | please see the Installation_ section above. This section is for anyone who | |
394 | wants to install the development version of the CLI. You normally would not | |
395 | need to do this unless: | |
396 | ||
397 | * You are developing a feature for the CLI and plan on submitting a Pull | |
398 | Request. | |
399 | * You want to test the latest changes of the CLI before they make it into an | |
400 | official release. | |
401 | ||
402 | The latest changes to the CLI are in the ``develop`` branch on github. This is | |
403 | the default branch when you clone the git repository. | |
404 | ||
405 | Additionally, there are several other packages that are developed in lockstep | |
406 | with the CLI. This includes: | |
407 | ||
408 | * `botocore <https://github.com/boto/botocore>`__ | |
409 | * `jmespath <https://github.com/boto/jmespath>`__ | |
410 | ||
411 | If you just want to install a snapshot of the latest development version of | |
412 | the CLI, you can use the ``requirements.txt`` file included in this repo. | |
413 | This file points to the development version of the above packages:: | |
414 | ||
415 | $ cd <path_to_awscli> | |
416 | $ python -m pip install -r requirements.txt | |
417 | $ python -m pip install -e . | |
418 | ||
419 | However, to keep up to date, you will continually have to run the | |
420 | ``python -m pip install -r requirements.txt`` file to pull in the latest changes | |
421 | from the develop branches of botocore, jmespath, etc. | |
422 | ||
423 | You can optionally clone each of those repositories and run "python -m pip install -e ." | |
424 | for each repository:: | |
425 | ||
426 | $ git clone <jmespath> && cd jmespath/ | |
427 | $ python -m pip install -e . && cd .. | |
428 | $ git clone <botocore> && cd botocore/ | |
429 | $ python -m pip install -e . && cd .. | |
430 | $ git clone <awscli> && cd aws-cli/ | |
431 | $ python -m pip install -e . | |
432 | ||
433 | ||
434 | ------------ | |
435 | Getting Help | |
436 | ------------ | |
437 | ||
438 | We use GitHub issues for tracking bugs and feature requests and have limited | |
439 | bandwidth to address them. Please use these community resources for getting | |
440 | help: | |
441 | ||
442 | * Ask a question on `Stack Overflow <https://stackoverflow.com/>`__ and tag it with `aws-cli <https://stackoverflow.com/questions/tagged/aws-cli>`__ | |
443 | * Come join the AWS CLI community chat on `gitter <https://gitter.im/aws/aws-cli>`__ | |
444 | * Open a support ticket with `AWS Support <https://console.aws.amazon.com/support/home#/>`__ | |
445 | * If it turns out that you may have found a bug, please `open an issue <https://github.com/aws/aws-cli/issues/new>`__ | |
446 | ||
447 | ||
448 | ||
449 | .. _`Amazon Web Services Security Bulletins website`: https://aws.amazon.com/security/security-bulletins | |
450 | .. _pip: https://pip.pypa.io/en/stable/ | |
451 | .. _`download the tarball`: https://pypi.org/project/awscli/ | |
129 | As you can see, you can have multiple `profiles` defined in both the shared credentials file and the configuration file. You can then specify which profile to use by using the `--profile` option. If no profile is specified the `default` profile is used. | |
130 | ||
131 | In the config file, except for the default profile, you **must** prefix each config section of a profile group with `profile`. For example, if you have a profile named \"testing\" the section header would be `[profile testing]`. | |
132 | ||
133 | The final option for credentials is highly recommended if you are using the AWS CLI on an EC2 instance. [IAM Roles](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html) are a great way to have credentials installed automatically on your instance. If you are using IAM Roles, the AWS CLI will find and use them automatically. | |
134 | ||
135 | In addition to credentials, a number of other variables can be configured either with environment variables, configuration file entries, or both. See the [AWS Tools and SDKs Shared Configuration and Credentials Reference Guide](https://docs.aws.amazon.com/credref/latest/refdocs/overview.html) for more information. | |
136 | ||
137 | For more information about configuration options, please refer to the [AWS | |
138 | CLI Configuration Variables topic](http://docs.aws.amazon.com/cli/latest/topic/config-vars.html#cli-aws-help-config-vars). You can access this topic from the AWS CLI as well by running `aws help config-vars`. | |
139 | ||
140 | ### Basic Commands | |
141 | ||
142 | An AWS CLI command has the following structure: | |
143 | ||
144 | $ aws <command> <subcommand> [options and parameters] | |
145 | ||
146 | For example, to list S3 buckets, the command would be: | |
147 | ||
148 | $ aws s3 ls | |
149 | ||
150 | To view help documentation, use one of the following: | |
151 | ||
152 | $ aws help | |
153 | $ aws <command> help | |
154 | $ aws <command> <subcommand> help | |
155 | ||
156 | To get the version of the AWS CLI: | |
157 | ||
158 | $ aws --version | |
159 | ||
160 | To turn on debugging output: | |
161 | ||
162 | $ aws --debug <command> <subcommand> | |
163 | ||
164 | You can read more information on the [Using the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-using.html) chapter of the AWS CLI User Guide. | |
165 | ||
166 | ### Command Completion | |
167 | ||
168 | The aws-cli package includes a command completion feature for Unix-like systems. This feature is not automatically installed so you need to configure it manually. To learn more, read the [AWS CLI Command completion topic](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-completion.html). | |
169 | ||
170 | ## Getting Help | |
171 | ||
172 | The best way to interact with our team is through GitHub. You can [open an issue](https://github.com/aws/aws-cli/issues/new/choose) and choose from one of our templates for guidance, bug reports, or feature requests. | |
173 | ||
174 | You may find help from the community on [Stack Overflow](https://stackoverflow.com/) with the tag [aws-cli](https://stackoverflow.com/questions/tagged/aws-cli) or on the [AWS Discussion Forum for CLI](https://forums.aws.amazon.com/forum.jspa?forumID=150). If you have a support plan with [AWS Premium Support](https://aws.amazon.com/premiumsupport), you can also create a new support case. | |
175 | ||
176 | Please check for open similar [issues](https://github.com/aws/aws-cli/issues/) before opening another one. | |
177 | ||
178 | The AWS CLI implements AWS service APIs. For general issues regarding the services or their limitations, you may find the [Amazon Web Services Discussion Forums](https://forums.aws.amazon.com/) helpful. | |
179 | ||
180 | ## More Resources | |
181 | ||
182 | - [Changelog](https://github.com/aws/aws-cli/blob/develop/CHANGELOG.rst) | |
183 | - [AWS CLI Documentation](https://docs.aws.amazon.com/cli/index.html) | |
184 | - [AWS CLI User Guide](https://docs.aws.amazon.com/cli/latest/userguide/) | |
185 | - [AWS CLI Command Reference](https://docs.aws.amazon.com/cli/latest/reference/) | |
186 | - [Amazon Web Services Discussion Forums](https://forums.aws.amazon.com/) | |
187 | - [AWS Support](https://console.aws.amazon.com/support/home#/) | |
452 | 188 | |
453 | 189 | Platform: UNKNOWN |
454 | 190 | Classifier: Development Status :: 5 - Production/Stable |
0 | 0 | LICENSE.txt |
1 | 1 | MANIFEST.in |
2 | README.rst | |
2 | README.md | |
3 | 3 | requirements.txt |
4 | 4 | setup.cfg |
5 | 5 | setup.py |
424 | 424 | awscli/examples/appmesh/update-virtual-node.rst |
425 | 425 | awscli/examples/appmesh/update-virtual-router.rst |
426 | 426 | awscli/examples/appmesh/update-virtual-service.rst |
427 | awscli/examples/athena/batch-get-named-query.rst | |
428 | awscli/examples/athena/batch-get-query-execution.rst | |
429 | awscli/examples/athena/create-data-catalog.rst | |
430 | awscli/examples/athena/create-named-query.rst | |
431 | awscli/examples/athena/create-work-group.rst | |
432 | awscli/examples/athena/delete-data-catalog.rst | |
433 | awscli/examples/athena/delete-named-query.rst | |
434 | awscli/examples/athena/delete-work-group.rst | |
435 | awscli/examples/athena/get-data-catalog.rst | |
436 | awscli/examples/athena/get-database.rst | |
437 | awscli/examples/athena/get-named-query.rst | |
438 | awscli/examples/athena/get-query-execution.rst | |
439 | awscli/examples/athena/get-query-results.rst | |
440 | awscli/examples/athena/get-table-metadata.rst | |
441 | awscli/examples/athena/get-work-group.rst | |
442 | awscli/examples/athena/list-data-catalogs.rst | |
443 | awscli/examples/athena/list-databases.rst | |
444 | awscli/examples/athena/list-named-queries.rst | |
445 | awscli/examples/athena/list-query-executions.rst | |
446 | awscli/examples/athena/list-table-metadata.rst | |
447 | awscli/examples/athena/list-tags-for-resource.rst | |
448 | awscli/examples/athena/list-work-groups.rst | |
449 | awscli/examples/athena/start-query-execution.rst | |
450 | awscli/examples/athena/stop-query-execution.rst | |
451 | awscli/examples/athena/tag-resource.rst | |
452 | awscli/examples/athena/untag-resource.rst | |
453 | awscli/examples/athena/update-data-catalog.rst | |
454 | awscli/examples/athena/update-work-group.rst | |
427 | 455 | awscli/examples/autoscaling/attach-instances.rst |
428 | 456 | awscli/examples/autoscaling/attach-load-balancer-target-groups.rst |
429 | 457 | awscli/examples/autoscaling/attach-load-balancers.rst |
1854 | 1882 | awscli/examples/elasticache/create-cache-cluster.rst |
1855 | 1883 | awscli/examples/elasticache/create-cache-parameter-group.rst |
1856 | 1884 | awscli/examples/elasticache/create-cache-subnet-group.rst |
1885 | awscli/examples/elasticache/create-global-replication-group.rst | |
1857 | 1886 | awscli/examples/elasticache/create-replication-group.rst |
1858 | 1887 | awscli/examples/elasticache/create-snapshot.rst |
1888 | awscli/examples/elasticache/decrease-node-groups-in-global-replication-group.rst | |
1859 | 1889 | awscli/examples/elasticache/decrease-replica-count.rst |
1860 | 1890 | awscli/examples/elasticache/delete-cache-cluster.rst |
1861 | 1891 | awscli/examples/elasticache/delete-cache-parameter-group.rst |
1862 | 1892 | awscli/examples/elasticache/delete-cache-subnet-group.rst |
1893 | awscli/examples/elasticache/delete-global-replication-group.rst | |
1863 | 1894 | awscli/examples/elasticache/delete-replication-group.rst |
1895 | awscli/examples/elasticache/delete-snapshot.rst | |
1864 | 1896 | awscli/examples/elasticache/describe-cache-clusters.rst |
1865 | 1897 | awscli/examples/elasticache/describe-cache-engine-versions.rst |
1866 | 1898 | awscli/examples/elasticache/describe-cache-parameter-groups.rst |
1867 | 1899 | awscli/examples/elasticache/describe-cache-parameters.rst |
1900 | awscli/examples/elasticache/describe-cache-subnet-groups.rst | |
1868 | 1901 | awscli/examples/elasticache/describe-engine-default-parameters.rst |
1869 | 1902 | awscli/examples/elasticache/describe-events.rst |
1870 | 1903 | awscli/examples/elasticache/describe-global-replication-groups.rst |
1875 | 1908 | awscli/examples/elasticache/describe-snapshots.rst |
1876 | 1909 | awscli/examples/elasticache/describe-update-actions.rst |
1877 | 1910 | awscli/examples/elasticache/disassociate-global-replication-group.rst |
1911 | awscli/examples/elasticache/increase-node-groups-in-global-replication-group.rst | |
1878 | 1912 | awscli/examples/elasticache/increase-replica-count.rst |
1879 | 1913 | awscli/examples/elasticache/list-allowed-node-type-modifications.rst |
1914 | awscli/examples/elasticache/list-tags-for-resource.rst | |
1880 | 1915 | awscli/examples/elasticache/modify-cache-cluster.rst |
1881 | 1916 | awscli/examples/elasticache/modify-cache-parameter-group.rst |
1882 | 1917 | awscli/examples/elasticache/modify-cache-subnet-group.rst |
1918 | awscli/examples/elasticache/modify-global-replication-group.rst | |
1919 | awscli/examples/elasticache/modify-replication-group-shard-configuration.rst | |
1883 | 1920 | awscli/examples/elasticache/modify-replication-group.rst |
1921 | awscli/examples/elasticache/purchase-reserved-cache-nodes-offering.rst | |
1884 | 1922 | awscli/examples/elasticache/reboot-cache-cluster.rst |
1885 | 1923 | awscli/examples/elasticache/reset-cache-parameter-group.rst |
1924 | awscli/examples/elasticache/start-migration.rst | |
1886 | 1925 | awscli/examples/elasticache/test-failover.rst |
1887 | 1926 | awscli/examples/elasticbeanstalk/abort-environment-update.rst |
1888 | 1927 | awscli/examples/elasticbeanstalk/check-dns-availability.rst |
2045 | 2084 | awscli/examples/events/put-targets.rst |
2046 | 2085 | awscli/examples/events/remove-targets.rst |
2047 | 2086 | awscli/examples/events/test-event-pattern.rst |
2087 | awscli/examples/firehose/list-delivery-streams.rst | |
2088 | awscli/examples/firehose/put-record-batch.rst | |
2089 | awscli/examples/firehose/put-record.rst | |
2048 | 2090 | awscli/examples/fms/associate-admin-account.rst |
2049 | 2091 | awscli/examples/fms/delete-notification-channel.rst |
2050 | 2092 | awscli/examples/fms/delete-policy.rst |
2138 | 2180 | awscli/examples/globalaccelerator/update-endpoint-group.rst |
2139 | 2181 | awscli/examples/globalaccelerator/update-listener.rst |
2140 | 2182 | awscli/examples/globalaccelerator/withdraw-byoip-cidr.rst |
2183 | awscli/examples/glue/start-crawler.rst | |
2184 | awscli/examples/glue/start-job-run.rst | |
2141 | 2185 | awscli/examples/greengrass/associate-role-to-group.rst |
2142 | 2186 | awscli/examples/greengrass/associate-service-role-to-account.rst |
2143 | 2187 | awscli/examples/greengrass/create-connector-definition-version.rst |
2478 | 2522 | awscli/examples/iot/cancel-job-execution.rst |
2479 | 2523 | awscli/examples/iot/cancel-job.rst |
2480 | 2524 | awscli/examples/iot/clear-default-authorizer.rst |
2525 | awscli/examples/iot/confirm-topic-rule-destination.rst | |
2481 | 2526 | awscli/examples/iot/create-authorizer.rst |
2482 | 2527 | awscli/examples/iot/create-billing-group.rst |
2483 | 2528 | awscli/examples/iot/create-certificate-from-csr.rst |
2499 | 2544 | awscli/examples/iot/create-thing-group.rst |
2500 | 2545 | awscli/examples/iot/create-thing-type.rst |
2501 | 2546 | awscli/examples/iot/create-thing.rst |
2547 | awscli/examples/iot/create-topic-rule-destination.rst | |
2502 | 2548 | awscli/examples/iot/create-topic-rule.rst |
2503 | 2549 | awscli/examples/iot/delete-account-audit-configuration.rst |
2504 | 2550 | awscli/examples/iot/delete-authorizer.rst |
2524 | 2570 | awscli/examples/iot/delete-thing-group.rst |
2525 | 2571 | awscli/examples/iot/delete-thing-type.rst |
2526 | 2572 | awscli/examples/iot/delete-thing.rst |
2573 | awscli/examples/iot/delete-topic-rule-destination.rst | |
2527 | 2574 | awscli/examples/iot/delete-topic-rule.rst |
2528 | 2575 | awscli/examples/iot/delete-v2-logging-level.rst |
2529 | 2576 | awscli/examples/iot/deprecate-thing-type.rst |
2567 | 2614 | awscli/examples/iot/get-policy.rst |
2568 | 2615 | awscli/examples/iot/get-registration-code.rst |
2569 | 2616 | awscli/examples/iot/get-statistics.rst |
2617 | awscli/examples/iot/get-topic-rule-destination.rst | |
2570 | 2618 | awscli/examples/iot/get-topic-rule.rst |
2571 | 2619 | awscli/examples/iot/get-v2-logging-options.rst |
2572 | 2620 | awscli/examples/iot/list-active-violations.rst |
2609 | 2657 | awscli/examples/iot/list-things-in-billing-group.rst |
2610 | 2658 | awscli/examples/iot/list-things-in-thing-group.rst |
2611 | 2659 | awscli/examples/iot/list-things.rst |
2660 | awscli/examples/iot/list-topic-rule-destinations.rst | |
2612 | 2661 | awscli/examples/iot/list-topic-rules.rst |
2613 | 2662 | awscli/examples/iot/list-v2-logging-levels.rst |
2614 | 2663 | awscli/examples/iot/list-violation-events.rst |
2649 | 2698 | awscli/examples/iot/update-thing-group.rst |
2650 | 2699 | awscli/examples/iot/update-thing-groups-for-thing.rst |
2651 | 2700 | awscli/examples/iot/update-thing.rst |
2701 | awscli/examples/iot/update-topic-rule-destination.rst | |
2652 | 2702 | awscli/examples/iot/validate-security-profile-behaviors.rst |
2653 | 2703 | awscli/examples/iot-data/delete-thing-shadow.rst |
2654 | 2704 | awscli/examples/iot-data/get-thing-shadow.rst |
2855 | 2905 | awscli/examples/iotthingsgraph/update-flow-template.rst |
2856 | 2906 | awscli/examples/iotthingsgraph/update-system-template.rst |
2857 | 2907 | awscli/examples/iotthingsgraph/upload-entity-definitions.rst |
2908 | awscli/examples/ivs/batch-get-channel.rst | |
2909 | awscli/examples/ivs/batch-get-stream-key.rst | |
2910 | awscli/examples/ivs/create-channel.rst | |
2911 | awscli/examples/ivs/create-stream-key.rst | |
2912 | awscli/examples/ivs/delete-stream-key.rst | |
2913 | awscli/examples/ivs/get-channel.rst | |
2914 | awscli/examples/ivs/get-stream-key.rst | |
2915 | awscli/examples/ivs/get-stream.rst | |
2916 | awscli/examples/ivs/list-channels.rst | |
2917 | awscli/examples/ivs/list-stream-keys.rst | |
2918 | awscli/examples/ivs/list-streams.rst | |
2919 | awscli/examples/ivs/put-metadata.rst | |
2920 | awscli/examples/ivs/stop-stream.rst | |
2921 | awscli/examples/ivs/update-channel.rst | |
2858 | 2922 | awscli/examples/kafka/create-cluster.rst |
2859 | 2923 | awscli/examples/kafka/create-configuration.rst |
2924 | awscli/examples/kafka/describe-cluster.rst | |
2925 | awscli/examples/kafka/get-bootstrap-brokers.rst | |
2926 | awscli/examples/kafka/list-clusters.rst | |
2860 | 2927 | awscli/examples/kafka/update-broker-storage.rst |
2861 | 2928 | awscli/examples/kafka/update-cluster-configuration.rst |
2862 | 2929 | awscli/examples/kinesis/add-tags-to-stream.rst |
2894 | 2961 | awscli/examples/kms/decrypt.rst |
2895 | 2962 | awscli/examples/kms/delete-alias.rst |
2896 | 2963 | awscli/examples/kms/delete-custom-key-store.rst |
2964 | awscli/examples/kms/delete-imported-key-material.rst | |
2897 | 2965 | awscli/examples/kms/describe-custom-key-stores.rst |
2898 | 2966 | awscli/examples/kms/describe-key.rst |
2967 | awscli/examples/kms/disable-key-rotation.rst | |
2968 | awscli/examples/kms/disable-key.rst | |
2899 | 2969 | awscli/examples/kms/disconnect-custom-key-store.rst |
2970 | awscli/examples/kms/enable-key-rotation.rst | |
2971 | awscli/examples/kms/enable-key.rst | |
2900 | 2972 | awscli/examples/kms/encrypt.rst |
2901 | 2973 | awscli/examples/kms/generate-random.rst |
2902 | 2974 | awscli/examples/kms/get-key-policy.rst |
2975 | awscli/examples/kms/get-key-rotation-status.rst | |
2976 | awscli/examples/kms/get-parameters-for-import.rst | |
2977 | awscli/examples/kms/get-public-key.rst | |
2978 | awscli/examples/kms/import-key-material.rst | |
2903 | 2979 | awscli/examples/kms/list-aliases.rst |
2904 | 2980 | awscli/examples/kms/list-grants.rst |
2981 | awscli/examples/kms/list-key-policies.rst | |
2982 | awscli/examples/kms/list-keys.rst | |
2983 | awscli/examples/kms/list-resource-tags.rst | |
2984 | awscli/examples/kms/list-retirable-grants.rst | |
2905 | 2985 | awscli/examples/kms/put-key-policy.rst |
2906 | 2986 | awscli/examples/kms/re-encrypt.rst |
2987 | awscli/examples/kms/retire-grant.rst | |
2988 | awscli/examples/kms/revoke-grant.rst | |
2907 | 2989 | awscli/examples/kms/schedule-key-deletion.rst |
2990 | awscli/examples/kms/sign.rst | |
2991 | awscli/examples/kms/tag-resource.rst | |
2992 | awscli/examples/kms/untag-resource.rst | |
2908 | 2993 | awscli/examples/kms/update-alias.rst |
2909 | 2994 | awscli/examples/kms/update-custom-key-store.rst |
2910 | 2995 | awscli/examples/kms/update-key-description.rst |
2996 | awscli/examples/kms/verify.rst | |
2911 | 2997 | awscli/examples/lambda/add-layer-version-permission.rst |
2912 | 2998 | awscli/examples/lambda/add-permission.rst |
2913 | 2999 | awscli/examples/lambda/create-alias.rst |
3215 | 3301 | awscli/examples/opsworks/create-deployment.rst |
3216 | 3302 | awscli/examples/opsworks/create-instance.rst |
3217 | 3303 | awscli/examples/opsworks/create-layer.rst |
3304 | awscli/examples/opsworks/create-server.rst | |
3218 | 3305 | awscli/examples/opsworks/create-stack.rst |
3219 | 3306 | awscli/examples/opsworks/create-user-profile.rst |
3220 | 3307 | awscli/examples/opsworks/delete-app.rst |
3372 | 3459 | awscli/examples/rds/add-role-to-db-instance.rst |
3373 | 3460 | awscli/examples/rds/add-source-identifier-to-subscription.rst |
3374 | 3461 | awscli/examples/rds/add-tags-to-resource.rst |
3462 | awscli/examples/rds/authorize-db-security-group-ingress.rst | |
3375 | 3463 | awscli/examples/rds/backtrack-db-cluster.rst |
3376 | 3464 | awscli/examples/rds/copy-db-cluster-parameter-group.rst |
3377 | 3465 | awscli/examples/rds/copy-db-cluster-snapshot.rst |
3424 | 3512 | awscli/examples/rds/describe-event-categories.rst |
3425 | 3513 | awscli/examples/rds/describe-event-subscriptions.rst |
3426 | 3514 | awscli/examples/rds/describe-events.rst |
3515 | awscli/examples/rds/describe-export-tasks.rst | |
3427 | 3516 | awscli/examples/rds/describe-option-group-options.rst |
3428 | 3517 | awscli/examples/rds/describe-option-groups.rst |
3429 | 3518 | awscli/examples/rds/describe-orderable-db-instance-options.rst |
3443 | 3532 | awscli/examples/rds/modify-db-snapshot-attribute.rst |
3444 | 3533 | awscli/examples/rds/modify-db-snapshot-attributes.rst |
3445 | 3534 | awscli/examples/rds/modify-db-snapshot.rst |
3535 | awscli/examples/rds/modify-db-subnet-group.rst | |
3446 | 3536 | awscli/examples/rds/modify-event-subscription.rst |
3447 | 3537 | awscli/examples/rds/promote-read-replica.rst |
3448 | 3538 | awscli/examples/rds/purchase-reserved-db-instance.rst |
3539 | awscli/examples/rds/purchase-reserved-db-instances-offerings.rst | |
3449 | 3540 | awscli/examples/rds/reboot-db-instance.rst |
3450 | 3541 | awscli/examples/rds/remove-option-from-option-group.rst |
3451 | 3542 | awscli/examples/rds/remove-role-from-db-instance.rst |
3456 | 3547 | awscli/examples/rds/restore-db-instance-from-s3.rst |
3457 | 3548 | awscli/examples/rds/restore-db-instance-to-point-in-time.rst |
3458 | 3549 | awscli/examples/rds/start-db-instance.rst |
3550 | awscli/examples/rds/start-export-task.rst | |
3551 | awscli/examples/rds/stop-db-cluster.rst | |
3459 | 3552 | awscli/examples/rds/stop-db-instance.rst |
3460 | 3553 | awscli/examples/rds-data/batch-execute-statement.rst |
3461 | 3554 | awscli/examples/rds-data/begin-transaction.rst |
4139 | 4232 | awscli/examples/ssm/update-resource-data-sync.rst |
4140 | 4233 | awscli/examples/ssm/update-service-setting.rst |
4141 | 4234 | awscli/examples/storagegateway/describe-gateway-information.rst |
4235 | awscli/examples/storagegateway/list-file-shares.rst | |
4142 | 4236 | awscli/examples/storagegateway/list-gateways.rst |
4143 | 4237 | awscli/examples/storagegateway/list-volumes.rst |
4238 | awscli/examples/storagegateway/refresh-cache.rst | |
4144 | 4239 | awscli/examples/sts/assume-role-with-saml.rst |
4145 | 4240 | awscli/examples/sts/assume-role-with-web-identity.rst |
4146 | 4241 | awscli/examples/sts/assume-role.rst |
0 | botocore==1.17.22 | |
0 | botocore==1.17.34 | |
1 | 1 | docutils<0.16,>=0.10 |
2 | 2 | s3transfer<0.4.0,>=0.3.0 |
3 | 3 | PyYAML<5.4,>=3.10 |
2 | 2 | |
3 | 3 | [metadata] |
4 | 4 | requires-dist = |
5 | botocore==1.17.22 | |
5 | botocore==1.17.34 | |
6 | 6 | docutils>=0.10,<0.16 |
7 | 7 | s3transfer>=0.3.0,<0.4.0 |
8 | 8 | PyYAML>=3.10,<5.3; python_version=='3.4' |
20 | 20 | .dependabot/* |
21 | 21 | .coveragerc |
22 | 22 | CHANGELOG.rst |
23 | CONTRIBUTING.rst | |
23 | CONTRIBUTING.md | |
24 | 24 | .travis.yml |
25 | 25 | requirements* |
26 | 26 | tox.ini |
23 | 23 | |
24 | 24 | |
25 | 25 | install_requires = [ |
26 | 'botocore==1.17.22', | |
26 | 'botocore==1.17.34', | |
27 | 27 | 'docutils>=0.10,<0.16', |
28 | 28 | 's3transfer>=0.3.0,<0.4.0', |
29 | 29 | ] |
43 | 43 | name='awscli', |
44 | 44 | version=find_version("awscli", "__init__.py"), |
45 | 45 | description='Universal Command Line Environment for AWS.', |
46 | long_description=read('README.rst'), | |
46 | long_description=read('README.md'), | |
47 | 47 | author='Amazon Web Services', |
48 | 48 | url='http://aws.amazon.com/cli/', |
49 | 49 | scripts=['bin/aws', 'bin/aws.cmd', |