diff --git a/.changes/1.16.142.json b/.changes/1.16.142.json new file mode 100644 index 000000000000..30f149decf6d --- /dev/null +++ b/.changes/1.16.142.json @@ -0,0 +1,12 @@ +[ + { + "category": "``polly``", + "description": "Update polly command to latest version", + "type": "api-change" + }, + { + "category": "``ec2``", + "description": "Update ec2 command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.143.json b/.changes/1.16.143.json new file mode 100644 index 000000000000..7978328a63fe --- /dev/null +++ b/.changes/1.16.143.json @@ -0,0 +1,37 @@ +[ + { + "category": "``cognito-idp``", + "description": "Update cognito-idp command to latest version", + "type": "api-change" + }, + { + "category": "``worklink``", + "description": "Update worklink command to latest version", + "type": "api-change" + }, + { + "category": "``rds``", + "description": "Update rds command to latest version", + "type": "api-change" + }, + { + "category": "``kafka``", + "description": "Update kafka command to latest version", + "type": "api-change" + }, + { + "category": "``organizations``", + "description": "Update organizations command to latest version", + "type": "api-change" + }, + { + "category": "``workspaces``", + "description": "Update workspaces command to latest version", + "type": "api-change" + }, + { + "category": "``discovery``", + "description": "Update discovery command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.144.json b/.changes/1.16.144.json new file mode 100644 index 000000000000..8274469b7e00 --- /dev/null +++ b/.changes/1.16.144.json @@ -0,0 +1,17 @@ +[ + { + "category": "``transcribe``", + "description": "Update transcribe command to latest version", + "type": "api-change" + }, + { + "category": "``workspaces``", + "description": "Update workspaces command to latest version", + "type": "api-change" + }, + { + "category": "``resource-groups``", + "description": "Update resource-groups command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.145.json b/.changes/1.16.145.json new file mode 100644 index 000000000000..d217834600c0 --- /dev/null +++ b/.changes/1.16.145.json @@ -0,0 +1,57 @@ +[ + { + "category": "``alexaforbusiness``", + "description": "Update alexaforbusiness command to latest version", + "type": "api-change" + }, + { + "category": "``textract``", + "description": "Update textract command to latest version", + "type": "api-change" + }, + { + "category": "``storagegateway``", + "description": "Update storagegateway command to latest version", + "type": "api-change" + }, + { + "category": "Cloudformation", + "description": "Support non-AWS partition regions in CloudFormation deploy and package. Fixes `#3635 `__.", + "type": "bugfix" + }, + { + "category": "``mediatailor``", + "description": "Update mediatailor command to latest version", + "type": "api-change" + }, + { + "category": "``route53``", + "description": "Update route53 command to latest version", + "type": "api-change" + }, + { + "category": "``ec2``", + "description": "Update ec2 command to latest version", + "type": "api-change" + }, + { + "category": "``ssm``", + "description": "Update ssm command to latest version", + "type": "api-change" + }, + { + "category": "``mediaconnect``", + "description": "Update mediaconnect command to latest version", + "type": "api-change" + }, + { + "category": "``rds``", + "description": "Update rds command to latest version", + "type": "api-change" + }, + { + "category": "``cloudformation``", + "description": "Update cloudformation command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.146.json b/.changes/1.16.146.json new file mode 100644 index 000000000000..bf6bd6ee7c00 --- /dev/null +++ b/.changes/1.16.146.json @@ -0,0 +1,32 @@ +[ + { + "category": "``batch``", + "description": "Update batch command to latest version", + "type": "api-change" + }, + { + "category": "``gamelift``", + "description": "Update gamelift command to latest version", + "type": "api-change" + }, + { + "category": "``inspector``", + "description": "Update inspector command to latest version", + "type": "api-change" + }, + { + "category": "``dynamodb``", + "description": "Update dynamodb command to latest version", + "type": "api-change" + }, + { + "category": "``lambda``", + "description": "Update lambda command to latest version", + "type": "api-change" + }, + { + "category": "``workspaces``", + "description": "Update workspaces command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.147.json b/.changes/1.16.147.json new file mode 100644 index 000000000000..e7c6fa465c46 --- /dev/null +++ b/.changes/1.16.147.json @@ -0,0 +1,12 @@ +[ + { + "category": "``iam``", + "description": "Update iam command to latest version", + "type": "api-change" + }, + { + "category": "``sns``", + "description": "Update sns command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.148.json b/.changes/1.16.148.json new file mode 100644 index 000000000000..b259c2c3d3b4 --- /dev/null +++ b/.changes/1.16.148.json @@ -0,0 +1,12 @@ +[ + { + "category": "``transfer``", + "description": "Update transfer command to latest version", + "type": "api-change" + }, + { + "category": "``ec2``", + "description": "Update ec2 command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.149.json b/.changes/1.16.149.json new file mode 100644 index 000000000000..03bb02e3184f --- /dev/null +++ b/.changes/1.16.149.json @@ -0,0 +1,32 @@ +[ + { + "category": "``codepipeline``", + "description": "Update codepipeline command to latest version", + "type": "api-change" + }, + { + "category": "``neptune``", + "description": "Update neptune command to latest version", + "type": "api-change" + }, + { + "category": "``managedblockchain``", + "description": "Update managedblockchain command to latest version", + "type": "api-change" + }, + { + "category": "``s3control``", + "description": "Update s3control command to latest version", + "type": "api-change" + }, + { + "category": "``servicecatalog``", + "description": "Update servicecatalog command to latest version", + "type": "api-change" + }, + { + "category": "``directconnect``", + "description": "Update directconnect command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.150.json b/.changes/1.16.150.json new file mode 100644 index 000000000000..3d5a17d8373e --- /dev/null +++ b/.changes/1.16.150.json @@ -0,0 +1,17 @@ +[ + { + "category": "``xray``", + "description": "Update xray command to latest version", + "type": "api-change" + }, + { + "category": "``ec2``", + "description": "Update ec2 command to latest version", + "type": "api-change" + }, + { + "category": "``ecs``", + "description": "Update ecs command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.151.json b/.changes/1.16.151.json new file mode 100644 index 000000000000..8730f9a84e7d --- /dev/null +++ b/.changes/1.16.151.json @@ -0,0 +1,12 @@ +[ + { + "category": "``alexaforbusiness``", + "description": "Update alexaforbusiness command to latest version", + "type": "api-change" + }, + { + "category": "``kms``", + "description": "Update kms command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.152.json b/.changes/1.16.152.json new file mode 100644 index 000000000000..5e5d413da72b --- /dev/null +++ b/.changes/1.16.152.json @@ -0,0 +1,22 @@ +[ + { + "category": "``mediaconvert``", + "description": "Update mediaconvert command to latest version", + "type": "api-change" + }, + { + "category": "``workmail``", + "description": "Update workmail command to latest version", + "type": "api-change" + }, + { + "category": "``medialive``", + "description": "Update medialive command to latest version", + "type": "api-change" + }, + { + "category": "``cognito-idp``", + "description": "Update cognito-idp command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.153.json b/.changes/1.16.153.json new file mode 100644 index 000000000000..159f139a3f41 --- /dev/null +++ b/.changes/1.16.153.json @@ -0,0 +1,22 @@ +[ + { + "category": "``config``", + "description": "Update config command to latest version", + "type": "api-change" + }, + { + "category": "``iam``", + "description": "Update iam command to latest version", + "type": "api-change" + }, + { + "category": "``codepipeline``", + "description": "Update codepipeline command to latest version", + "type": "api-change" + }, + { + "category": "``sts``", + "description": "Update sts command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.154.json b/.changes/1.16.154.json new file mode 100644 index 000000000000..1461c222b09d --- /dev/null +++ b/.changes/1.16.154.json @@ -0,0 +1,22 @@ +[ + { + "category": "``alexaforbusiness``", + "description": "Update alexaforbusiness command to latest version", + "type": "api-change" + }, + { + "category": "``storagegateway``", + "description": "Update storagegateway command to latest version", + "type": "api-change" + }, + { + "category": "``ssm``", + "description": "Update ssm command to latest version", + "type": "api-change" + }, + { + "category": "``appsync``", + "description": "Update appsync command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.155.json b/.changes/1.16.155.json new file mode 100644 index 000000000000..249b7d554cec --- /dev/null +++ b/.changes/1.16.155.json @@ -0,0 +1,27 @@ +[ + { + "category": "``sagemaker``", + "description": "Update sagemaker command to latest version", + "type": "api-change" + }, + { + "category": "``kinesisanalytics``", + "description": "Update kinesisanalytics command to latest version", + "type": "api-change" + }, + { + "category": "``eks``", + "description": "Update eks command to latest version", + "type": "api-change" + }, + { + "category": "``servicecatalog``", + "description": "Update servicecatalog command to latest version", + "type": "api-change" + }, + { + "category": "``kinesisanalyticsv2``", + "description": "Update kinesisanalyticsv2 command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.156.json b/.changes/1.16.156.json new file mode 100644 index 000000000000..4acd145b0dc1 --- /dev/null +++ b/.changes/1.16.156.json @@ -0,0 +1,12 @@ +[ + { + "category": "``glue``", + "description": "Update glue command to latest version", + "type": "api-change" + }, + { + "category": "``sts``", + "description": "Update sts command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.157.json b/.changes/1.16.157.json new file mode 100644 index 000000000000..76c9ae511867 --- /dev/null +++ b/.changes/1.16.157.json @@ -0,0 +1,17 @@ +[ + { + "category": "``datasync``", + "description": "Update datasync command to latest version", + "type": "api-change" + }, + { + "category": "``lambda``", + "description": "Update lambda command to latest version", + "type": "api-change" + }, + { + "category": "``iotanalytics``", + "description": "Update iotanalytics command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.158.json b/.changes/1.16.158.json new file mode 100644 index 000000000000..50e22fe0551a --- /dev/null +++ b/.changes/1.16.158.json @@ -0,0 +1,22 @@ +[ + { + "category": "``storagegateway``", + "description": "Update storagegateway command to latest version", + "type": "api-change" + }, + { + "category": "``comprehend``", + "description": "Update comprehend command to latest version", + "type": "api-change" + }, + { + "category": "``chime``", + "description": "Update chime command to latest version", + "type": "api-change" + }, + { + "category": "``ec2``", + "description": "Update ec2 command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.159.json b/.changes/1.16.159.json new file mode 100644 index 000000000000..7b9f6b15cf0d --- /dev/null +++ b/.changes/1.16.159.json @@ -0,0 +1,27 @@ +[ + { + "category": "``ec2``", + "description": "Update ec2 command to latest version", + "type": "api-change" + }, + { + "category": "``codepipeline``", + "description": "Update codepipeline command to latest version", + "type": "api-change" + }, + { + "category": "``rds``", + "description": "Update rds command to latest version", + "type": "api-change" + }, + { + "category": "``transcribe``", + "description": "Update transcribe command to latest version", + "type": "api-change" + }, + { + "category": "``mediapackage``", + "description": "Update mediapackage command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/1.16.160.json b/.changes/1.16.160.json new file mode 100644 index 000000000000..3bd70644c25a --- /dev/null +++ b/.changes/1.16.160.json @@ -0,0 +1,12 @@ +[ + { + "category": "``medialive``", + "description": "Update medialive command to latest version", + "type": "api-change" + }, + { + "category": "``s3``", + "description": "Update s3 command to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 230016878c90..da53e046b211 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,178 @@ CHANGELOG ========= +1.16.160 +======== + +* api-change:``medialive``: Update medialive command to latest version +* api-change:``s3``: Update s3 command to latest version + + +1.16.159 +======== + +* api-change:``ec2``: Update ec2 command to latest version +* api-change:``codepipeline``: Update codepipeline command to latest version +* api-change:``rds``: Update rds command to latest version +* api-change:``transcribe``: Update transcribe command to latest version +* api-change:``mediapackage``: Update mediapackage command to latest version + + +1.16.158 +======== + +* api-change:``storagegateway``: Update storagegateway command to latest version +* api-change:``comprehend``: Update comprehend command to latest version +* api-change:``chime``: Update chime command to latest version +* api-change:``ec2``: Update ec2 command to latest version + + +1.16.157 +======== + +* api-change:``datasync``: Update datasync command to latest version +* api-change:``lambda``: Update lambda command to latest version +* api-change:``iotanalytics``: Update iotanalytics command to latest version + + +1.16.156 +======== + +* api-change:``glue``: Update glue command to latest version +* api-change:``sts``: Update sts command to latest version + + +1.16.155 +======== + +* api-change:``sagemaker``: Update sagemaker command to latest version +* api-change:``kinesisanalytics``: Update kinesisanalytics command to latest version +* api-change:``eks``: Update eks command to latest version +* api-change:``servicecatalog``: Update servicecatalog command to latest version +* api-change:``kinesisanalyticsv2``: Update kinesisanalyticsv2 command to latest version + + +1.16.154 +======== + +* api-change:``alexaforbusiness``: Update alexaforbusiness command to latest version +* api-change:``storagegateway``: Update storagegateway command to latest version +* api-change:``ssm``: Update ssm command to latest version +* api-change:``appsync``: Update appsync command to latest version + + +1.16.153 +======== + +* api-change:``config``: Update config command to latest version +* api-change:``iam``: Update iam command to latest version +* api-change:``codepipeline``: Update codepipeline command to latest version +* api-change:``sts``: Update sts command to latest version + + +1.16.152 +======== + +* api-change:``mediaconvert``: Update mediaconvert command to latest version +* api-change:``workmail``: Update workmail command to latest version +* api-change:``medialive``: Update medialive command to latest version +* api-change:``cognito-idp``: Update cognito-idp command to latest version + + +1.16.151 +======== + +* api-change:``alexaforbusiness``: Update alexaforbusiness command to latest version +* api-change:``kms``: Update kms command to latest version + + +1.16.150 +======== + +* api-change:``xray``: Update xray command to latest version +* api-change:``ec2``: Update ec2 command to latest version +* api-change:``ecs``: Update ecs command to latest version + + +1.16.149 +======== + +* api-change:``codepipeline``: Update codepipeline command to latest version +* api-change:``neptune``: Update neptune command to latest version +* api-change:``managedblockchain``: Update managedblockchain command to latest version +* api-change:``s3control``: Update s3control command to latest version +* api-change:``servicecatalog``: Update servicecatalog command to latest version +* api-change:``directconnect``: Update directconnect command to latest version + + +1.16.148 +======== + +* api-change:``transfer``: Update transfer command to latest version +* api-change:``ec2``: Update ec2 command to latest version + + +1.16.147 +======== + +* api-change:``iam``: Update iam command to latest version +* api-change:``sns``: Update sns command to latest version + + +1.16.146 +======== + +* api-change:``batch``: Update batch command to latest version +* api-change:``gamelift``: Update gamelift command to latest version +* api-change:``inspector``: Update inspector command to latest version +* api-change:``dynamodb``: Update dynamodb command to latest version +* api-change:``lambda``: Update lambda command to latest version +* api-change:``workspaces``: Update workspaces command to latest version + + +1.16.145 +======== + +* api-change:``alexaforbusiness``: Update alexaforbusiness command to latest version +* api-change:``textract``: Update textract command to latest version +* api-change:``storagegateway``: Update storagegateway command to latest version +* bugfix:Cloudformation: Support non-AWS partition regions in CloudFormation deploy and package. Fixes `#3635 `__. +* api-change:``mediatailor``: Update mediatailor command to latest version +* api-change:``route53``: Update route53 command to latest version +* api-change:``ec2``: Update ec2 command to latest version +* api-change:``ssm``: Update ssm command to latest version +* api-change:``mediaconnect``: Update mediaconnect command to latest version +* api-change:``rds``: Update rds command to latest version +* api-change:``cloudformation``: Update cloudformation command to latest version + + +1.16.144 +======== + +* api-change:``transcribe``: Update transcribe command to latest version +* api-change:``workspaces``: Update workspaces command to latest version +* api-change:``resource-groups``: Update resource-groups command to latest version + + +1.16.143 +======== + +* api-change:``cognito-idp``: Update cognito-idp command to latest version +* api-change:``worklink``: Update worklink command to latest version +* api-change:``rds``: Update rds command to latest version +* api-change:``kafka``: Update kafka command to latest version +* api-change:``organizations``: Update organizations command to latest version +* api-change:``workspaces``: Update workspaces command to latest version +* api-change:``discovery``: Update discovery command to latest version + + +1.16.142 +======== + +* api-change:``polly``: Update polly command to latest version +* api-change:``ec2``: Update ec2 command to latest version + + 1.16.141 ======== diff --git a/awscli/__init__.py b/awscli/__init__.py index 6dd55accee7c..e7ac8ae6d3ee 100644 --- a/awscli/__init__.py +++ b/awscli/__init__.py @@ -17,7 +17,7 @@ """ import os -__version__ = '1.16.141' +__version__ = '1.16.160' # # Get our data path to be added to botocore's search path diff --git a/awscli/compat.py b/awscli/compat.py index 9817d96045ec..66dc6c38054e 100644 --- a/awscli/compat.py +++ b/awscli/compat.py @@ -22,6 +22,8 @@ from botocore.compat import six #import botocore.compat +from botocore.compat import OrderedDict + # If you ever want to import from the vendored six. Add it here and then # import from awscli.compat. Also try to keep it in alphabetical order. # This may get large. @@ -97,6 +99,7 @@ def ensure_text_type(s): if six.PY3: + import collections.abc as collections_abc import locale import urllib.parse as urlparse @@ -146,6 +149,7 @@ def bytes_print(statement, stdout=None): else: import codecs + import collections as collections_abc import locale import io import urlparse @@ -339,71 +343,4 @@ def ignore_user_entered_signals(): yield finally: for sig, user_signal in enumerate(signal_list): - signal.signal(user_signal, actual_signals[sig]) - - -def _backport_which(cmd, mode=os.F_OK | os.X_OK, path=None): - """Given a command, mode, and a PATH string, return the path which - conforms to the given mode on the PATH, or None if there is no such - file. - `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result - of os.environ.get("PATH"), or can be overridden with a custom search - path. - """ - # Check that a given file can be accessed with the correct mode. - # Additionally check that `file` is not a directory, as on Windows - # directories pass the os.access check. - def _access_check(fn, mode): - return (os.path.exists(fn) and os.access(fn, mode) - and not os.path.isdir(fn)) - - # If we're given a path with a directory part, look it up directly rather - # than referring to PATH directories. This includes checking relative to the - # current directory, e.g. ./script - if os.path.dirname(cmd): - if _access_check(cmd, mode): - return cmd - return None - - if path is None: - path = os.environ.get("PATH", os.defpath) - if not path: - return None - path = path.split(os.pathsep) - - if sys.platform == "win32": - # The current directory takes precedence on Windows. - if not os.curdir in path: - path.insert(0, os.curdir) - - # PATHEXT is necessary to check on Windows. - pathext = os.environ.get("PATHEXT", "").split(os.pathsep) - # See if the given file matches any of the expected path extensions. - # This will allow us to short circuit when given "python.exe". - # If it does match, only test that one, otherwise we have to try - # others. - if any(cmd.lower().endswith(ext.lower()) for ext in pathext): - files = [cmd] - else: - files = [cmd + ext for ext in pathext] - else: - # On other platforms you don't have things like PATHEXT to tell you - # what file suffixes are executable, so just pass on cmd as-is. - files = [cmd] - - seen = set() - for dir in path: - normdir = os.path.normcase(dir) - if not normdir in seen: - seen.add(normdir) - for thefile in files: - name = os.path.join(dir, thefile) - if _access_check(name, mode): - return name - return None - - -try: - from shutil import which -except ImportError: - which = _backport_which + signal.signal(user_signal, actual_signals[sig]) \ No newline at end of file diff --git a/awscli/customizations/argrename.py b/awscli/customizations/argrename.py index 7c8fc9e93126..4ed965caab06 100644 --- a/awscli/customizations/argrename.py +++ b/awscli/customizations/argrename.py @@ -49,6 +49,8 @@ 'route53.update-traffic-policy-comment.version': 'traffic-policy-version', 'gamelift.create-build.version': 'build-version', 'gamelift.update-build.version': 'build-version', + 'gamelift.create-script.version': 'script-version', + 'gamelift.update-script.version': 'script-version', 'route53domains.view-billing.start': 'start-time', 'route53domains.view-billing.end': 'end-time', 'apigateway.create-rest-api.version': 'api-version', diff --git a/awscli/customizations/cloudformation/artifact_exporter.py b/awscli/customizations/cloudformation/artifact_exporter.py index b8efe15d7558..a250449e030d 100644 --- a/awscli/customizations/cloudformation/artifact_exporter.py +++ b/awscli/customizations/cloudformation/artifact_exporter.py @@ -495,12 +495,23 @@ class ServerlessApplicationResource(CloudFormationStackResource): ] -def include_transform_export_handler(template_dict, uploader): +def include_transform_export_handler(template_dict, uploader, parent_dir): if template_dict.get("Name", None) != "AWS::Include": return template_dict - include_location = template_dict.get("Parameters", {}).get("Location", {}) - if (is_local_file(include_location)): - template_dict["Parameters"]["Location"] = uploader.upload_with_dedup(include_location) + + include_location = template_dict.get("Parameters", {}).get("Location", None) + if not include_location or is_s3_url(include_location): + return template_dict + + abs_include_location = os.path.join(parent_dir, include_location) + if is_local_file(abs_include_location): + template_dict["Parameters"]["Location"] = uploader.upload_with_dedup(abs_include_location) + else: + raise exceptions.InvalidLocalPathError( + resource_id="AWS::Include", + property_name="Location", + local_path=abs_include_location) + return template_dict @@ -547,7 +558,7 @@ def export_global_artifacts(self, template_dict): """ for key, val in template_dict.items(): if key in GLOBAL_EXPORT_DICT: - template_dict[key] = GLOBAL_EXPORT_DICT[key](val, self.uploader) + template_dict[key] = GLOBAL_EXPORT_DICT[key](val, self.uploader, self.template_dir) elif isinstance(val, dict): self.export_global_artifacts(val) elif isinstance(val, list): diff --git a/awscli/customizations/cloudformation/deploy.py b/awscli/customizations/cloudformation/deploy.py index 61a132b0c262..3b944045ff3a 100644 --- a/awscli/customizations/cloudformation/deploy.py +++ b/awscli/customizations/cloudformation/deploy.py @@ -280,7 +280,6 @@ def _run_main(self, parsed_args, parsed_globals): s3_uploader = S3Uploader(s3_client, bucket, - parsed_globals.region, parsed_args.s3_prefix, parsed_args.kms_key_id, parsed_args.force_upload) diff --git a/awscli/customizations/cloudformation/package.py b/awscli/customizations/cloudformation/package.py index bd45ac9368a1..9bc7464d442e 100644 --- a/awscli/customizations/cloudformation/package.py +++ b/awscli/customizations/cloudformation/package.py @@ -139,7 +139,6 @@ def _run_main(self, parsed_args, parsed_globals): self.s3_uploader = S3Uploader(s3_client, bucket, - parsed_globals.region, parsed_args.s3_prefix, parsed_args.kms_key_id, parsed_args.force_upload) diff --git a/awscli/customizations/eks/__init__.py b/awscli/customizations/eks/__init__.py index 61eaaa732a53..9f3114a64d84 100644 --- a/awscli/customizations/eks/__init__.py +++ b/awscli/customizations/eks/__init__.py @@ -12,6 +12,7 @@ # language governing permissions and limitations under the License. from awscli.customizations.eks.update_kubeconfig import UpdateKubeconfigCommand +from awscli.customizations.eks.get_token import GetTokenCommand def initialize(cli): @@ -27,3 +28,4 @@ def inject_commands(command_table, session, **kwargs): Used to inject new high level commands into the command list. """ command_table['update-kubeconfig'] = UpdateKubeconfigCommand(session) + command_table['get-token'] = GetTokenCommand(session) diff --git a/awscli/customizations/eks/get_token.py b/awscli/customizations/eks/get_token.py new file mode 100644 index 000000000000..8594be570561 --- /dev/null +++ b/awscli/customizations/eks/get_token.py @@ -0,0 +1,151 @@ +# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You +# may not use this file except in compliance with the License. A copy of +# the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF +# ANY KIND, either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +import base64 +import botocore +import json + +from botocore import session +from botocore.signers import RequestSigner +from botocore.model import ServiceId + +from awscli.customizations.commands import BasicCommand +from awscli.customizations.utils import uni_print + +AUTH_SERVICE = "sts" +AUTH_COMMAND = "GetCallerIdentity" +AUTH_API_VERSION = "2011-06-15" +AUTH_SIGNING_VERSION = "v4" + +# Presigned url timeout in seconds +URL_TIMEOUT = 60 + +TOKEN_PREFIX = 'k8s-aws-v1.' + +CLUSTER_NAME_HEADER = 'x-k8s-aws-id' + + +class GetTokenCommand(BasicCommand): + NAME = 'get-token' + + DESCRIPTION = ("Get a token for authentication with an Amazon EKS cluster. " + "This can be used as an alternative to the " + "aws-iam-authenticator.") + + ARG_TABLE = [ + { + 'name': 'cluster-name', + 'help_text': ("Specify the name of the Amazon EKS cluster to create a token for."), + 'required': True + }, + { + 'name': 'role-arn', + 'help_text': ("Assume this role for credentials when signing the token."), + 'required': False + } + ] + + def _run_main(self, parsed_args, parsed_globals): + token_generator = TokenGenerator(parsed_globals.region) + token = token_generator.get_token( + parsed_args.cluster_name, + parsed_args.role_arn + ) + + full_object = { + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1alpha1", + "spec": {}, + "status": { + "token": token + } + } + + uni_print(json.dumps(full_object)) + uni_print('\n') + +class TokenGenerator(object): + def __init__(self, region_name, session_handler=None): + if session_handler is None: + session_handler = SessionHandler() + self._session_handler = session_handler + self._region_name = region_name + + def get_token(self, cluster_name, role_arn): + """ Generate a presigned url token to pass to kubectl. """ + url = self._get_presigned_url(cluster_name, role_arn) + token = TOKEN_PREFIX + base64.urlsafe_b64encode(url.encode('utf-8')).decode('utf-8').rstrip('=') + return token + + def _get_presigned_url(self, cluster_name, role_arn): + session = self._session_handler.get_session( + self._region_name, + role_arn + ) + + if self._region_name is None: + self._region_name = session.get_config_variable('region') + + loader = botocore.loaders.create_loader() + data = loader.load_data("endpoints") + endpoint_resolver = botocore.regions.EndpointResolver(data) + endpoint = endpoint_resolver.construct_endpoint( + AUTH_SERVICE, + self._region_name + ) + signer = RequestSigner( + ServiceId(AUTH_SERVICE), + self._region_name, + AUTH_SERVICE, + AUTH_SIGNING_VERSION, + session.get_credentials(), + session.get_component('event_emitter') + ) + action_params='Action=' + AUTH_COMMAND + '&Version=' + AUTH_API_VERSION + params = { + 'method': 'GET', + 'url': 'https://' + endpoint["hostname"] + '/?' + action_params, + 'body': {}, + 'headers': {CLUSTER_NAME_HEADER: cluster_name}, + 'context': {} + } + + url=signer.generate_presigned_url( + params, + region_name=endpoint["credentialScope"]["region"], + operation_name='', + expires_in=URL_TIMEOUT + ) + return url + +class SessionHandler(object): + def get_session(self, region_name, role_arn): + """ + Assumes the given role and returns a session object assuming said role. + """ + session = botocore.session.get_session() + if region_name is not None: + session.set_config_variable('region', region_name) + + if role_arn is not None: + sts = session.create_client(AUTH_SERVICE, region_name=region_name) + credentials_dict = sts.assume_role( + RoleArn=role_arn, + RoleSessionName='EKSGetTokenAuth' + )['Credentials'] + + session.set_credentials(credentials_dict['AccessKeyId'], + credentials_dict['SecretAccessKey'], + credentials_dict['SessionToken']) + return session + else: + return session diff --git a/awscli/customizations/eks/update_kubeconfig.py b/awscli/customizations/eks/update_kubeconfig.py index 7d15c0bcb952..0dad708b7fb1 100644 --- a/awscli/customizations/eks/update_kubeconfig.py +++ b/awscli/customizations/eks/update_kubeconfig.py @@ -18,8 +18,6 @@ from awscli.customizations.commands import BasicCommand from awscli.customizations.utils import uni_print -from awscli.compat import is_windows -from awscli.compat import which from awscli.customizations.eks.exceptions import EKSClusterError from awscli.customizations.eks.kubeconfig import (Kubeconfig, KubeconfigError, @@ -38,31 +36,6 @@ # Do a check on the cluster's version number API_VERSION = "client.authentication.k8s.io/v1alpha1" -AUTH_BIN = "aws-iam-authenticator" - -AUTH_GOGET_PATH = ("github.com/kubernetes-sigs/" - "aws-iam-authenticator/cmd/aws-iam-authenticator") - - -def check_for_binary(binary): - return which(binary) is not None - -def warn_of_missing_dependencies(): - """ - Check the dependencies of the kubectl configuration generated by - update-kubeconfig to see if any are missing. - If they are missing, print a warning with information on how to download - the missing dependency - - Currently dependent on: - aws-iam-authenticator - """ - if not check_for_binary(AUTH_BIN): - uni_print("Warning: {0} is not installed properly or is not in your path.\n" - "Refer to the AWS Documentation to download it at " - "https://docs.aws.amazon.com/eks/latest/userguide/configure-kubectl.html\n".format(AUTH_BIN)) - - class UpdateKubeconfigCommand(BasicCommand): NAME = 'update-kubeconfig' @@ -128,7 +101,7 @@ class UpdateKubeconfigCommand(BasicCommand): ] def _display_entries(self, entries): - """ + """ Display entries in yaml format :param entries: a list of OrderedDicts to be printed @@ -183,7 +156,6 @@ def _run_main(self, parsed_args, parsed_globals): new_cluster_dict ]) - warn_of_missing_dependencies() class KubeconfigSelector(object): @@ -276,7 +248,7 @@ def _get_cluster_description(self): client = self._session.create_client("eks") else: client = self._session.create_client( - "eks", + "eks", region_name=self._globals.region, endpoint_url=self._globals.endpoint_url, verify=self._globals.verify_ssl @@ -315,6 +287,9 @@ def get_user_entry(self): Return a user entry generated using the previously obtained description. """ + + region = self._get_cluster_description().get("arn").split(":")[3] + generated_user = OrderedDict([ ("name", self._get_cluster_description().get("arn", "")), ("user", OrderedDict([ @@ -322,21 +297,21 @@ def get_user_entry(self): ("apiVersion", API_VERSION), ("args", [ - "token", - "-i", - self._cluster_name + "--region", + region, + "eks", + "get-token", + "--cluster-name", + self._cluster_name, ]), - ("command", AUTH_BIN) + ("command", "aws") ])) ])) ]) - if is_windows: - generated_user["user"]["exec"]["command"] += ".exe" - if self._role_arn is not None: generated_user["user"]["exec"]["args"].extend([ - "-r", + "--role", self._role_arn ]) diff --git a/awscli/customizations/s3uploader.py b/awscli/customizations/s3uploader.py index 1d826390175a..d61e47407d6c 100644 --- a/awscli/customizations/s3uploader.py +++ b/awscli/customizations/s3uploader.py @@ -22,6 +22,8 @@ from s3transfer.manager import TransferManager from s3transfer.subscribers import BaseSubscriber +from awscli.compat import collections_abc + LOG = logging.getLogger(__name__) @@ -53,13 +55,12 @@ def artifact_metadata(self): @artifact_metadata.setter def artifact_metadata(self, val): - if val is not None and type(val) is not dict: + if val is not None and not isinstance(val, collections_abc.Mapping): raise TypeError("Artifact metadata should be in dict type") self._artifact_metadata = val def __init__(self, s3_client, bucket_name, - region, prefix=None, kms_key_id=None, force_upload=False, @@ -69,7 +70,6 @@ def __init__(self, s3_client, self.kms_key_id = kms_key_id or None self.force_upload = force_upload self.s3 = s3_client - self.region = region self.transfer_manager = transfer_manager if not transfer_manager: @@ -195,10 +195,7 @@ def to_path_style_s3_url(self, key, version=None): This link describes the format of Path Style URLs http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro """ - base = "https://s3.amazonaws.com" - if self.region and self.region != "us-east-1": - base = "https://s3-{0}.amazonaws.com".format(self.region) - + base = self.s3.meta.endpoint_url result = "{0}/{1}/{2}".format(base, self.bucket_name, key) if version: result = "{0}?versionId={1}".format(result, version) diff --git a/awscli/customizations/servicecatalog/generatebase.py b/awscli/customizations/servicecatalog/generatebase.py index 6b7c6d63d5c7..3e7b59373f7a 100644 --- a/awscli/customizations/servicecatalog/generatebase.py +++ b/awscli/customizations/servicecatalog/generatebase.py @@ -30,7 +30,6 @@ def _run_main(self, parsed_args, parsed_globals): ) self.s3_uploader = S3Uploader(self.s3_client, parsed_args.bucket_name, - self.region, force_upload=True) try: self.s3_uploader.upload(parsed_args.file_path, diff --git a/awscli/examples/acm-pca/create-certificate-authority-audit-report.rst b/awscli/examples/acm-pca/create-certificate-authority-audit-report.rst index d40a5015a4ac..3b4c2907767d 100644 --- a/awscli/examples/acm-pca/create-certificate-authority-audit-report.rst +++ b/awscli/examples/acm-pca/create-certificate-authority-audit-report.rst @@ -1,5 +1,5 @@ -**To create a certificate authority audit report** - -The ``create-certificate-authority-audit-report`` command creates an audit report for your private CA:: - - aws acm-pca create-certificate-authority-audit-report --certificate-authority-arn arn:aws:acm-pca:us-east-1:account:certificate-authority/12345678-1234-1234-1234-123456789012 --s3-bucket-name your-bucket-name --audit-report-response-format JSON \ No newline at end of file +**To create a certificate authority audit report** + +The following ``create-certificate-authority-audit-report`` command creates an audit report for the private CA identified by the ARN. :: + + aws acm-pca create-certificate-authority-audit-report --certificate-authority-arn arn:aws:acm-pca:us-east-1:accountid:certificate-authority/12345678-1234-1234-1234-123456789012 --s3-bucket-name your-bucket-name --audit-report-response-format JSON \ No newline at end of file diff --git a/awscli/examples/acm-pca/create-certificate-authority.rst b/awscli/examples/acm-pca/create-certificate-authority.rst index 09e51d33e20c..9e4b33ab90b6 100644 --- a/awscli/examples/acm-pca/create-certificate-authority.rst +++ b/awscli/examples/acm-pca/create-certificate-authority.rst @@ -1,5 +1,5 @@ -**To create a private certificate authority** - -The ``create-certificate-authority`` command creates a private certificate authority in your AWS account:: - +**To create a private certificate authority** + +The following ``create-certificate-authority`` command creates a private certificate authority in your AWS account. :: + aws acm-pca create-certificate-authority --certificate-authority-configuration file://C:\ca_config.txt --revocation-configuration file://C:\revoke_config.txt --certificate-authority-type "SUBORDINATE" --idempotency-token 98256344 \ No newline at end of file diff --git a/awscli/examples/acm-pca/delete-certificate-authority.rst b/awscli/examples/acm-pca/delete-certificate-authority.rst index c33b4df9f729..e2c1c2ebe760 100644 --- a/awscli/examples/acm-pca/delete-certificate-authority.rst +++ b/awscli/examples/acm-pca/delete-certificate-authority.rst @@ -1,5 +1,5 @@ -**To delete a private certificate authority** - -The ``delete-certificate-authority`` command :: - - aws acm-pca delete-certificate-authority --certificate-authority-arn arn:aws:acm-pca:us-east-1:account:certificate-authority/12345678-1234-1234-1234-123456789012 \ No newline at end of file +**To delete a private certificate authority** + +The following ``delete-certificate-authority`` command deletes the certificate authority identified by the ARN. :: + + aws acm-pca delete-certificate-authority --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 \ No newline at end of file diff --git a/awscli/examples/acm-pca/describe-certificate-authority-audit-report.rst b/awscli/examples/acm-pca/describe-certificate-authority-audit-report.rst index b303871c6c79..e90b3cb0e8ab 100644 --- a/awscli/examples/acm-pca/describe-certificate-authority-audit-report.rst +++ b/awscli/examples/acm-pca/describe-certificate-authority-audit-report.rst @@ -1,5 +1,5 @@ -**To describe an audit report for a certificate authority** - -The ``describe-certificate-authority-audit-report`` command lists information about your audit report:: - - aws acm-pca describe-certificate-authority-audit-report --certificate-authority-arn arn:aws:acm-pca:us-east-1:account:certificate-authority/99999999-8888-7777-6666-555555555555 --audit-report-id 11111111-2222-3333-4444-555555555555 \ No newline at end of file +**To describe an audit report for a certificate authority** + +The following ``describe-certificate-authority-audit-report`` command lists information about the specified audit report for the CA identified by the ARN. :: + + aws acm-pca describe-certificate-authority-audit-report --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/99999999-8888-7777-6666-555555555555 --audit-report-id 11111111-2222-3333-4444-555555555555 \ No newline at end of file diff --git a/awscli/examples/acm-pca/describe-certificate-authority.rst b/awscli/examples/acm-pca/describe-certificate-authority.rst index 1978bc27ef3a..0599f8cd50f2 100644 --- a/awscli/examples/acm-pca/describe-certificate-authority.rst +++ b/awscli/examples/acm-pca/describe-certificate-authority.rst @@ -1,5 +1,5 @@ -**To describe a private certificate authority** - -The ``describe-certificate-authority`` command lists information about your private CA:: - - aws acm-pca describe-certificate-authority --certificate-authority-arn arn:aws:acm-pca:us-east-1:account:certificate-authority/12345678-1234-1234-1234-123456789012 \ No newline at end of file +**To describe a private certificate authority** + +The following ``describe-certificate-authority`` command lists information about the private CA identified by the ARN. :: + + aws acm-pca describe-certificate-authority --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 \ No newline at end of file diff --git a/awscli/examples/acm-pca/get-certificate-authority-certificate.rst b/awscli/examples/acm-pca/get-certificate-authority-certificate.rst index 4731bf27d90e..3a562c8f7823 100644 --- a/awscli/examples/acm-pca/get-certificate-authority-certificate.rst +++ b/awscli/examples/acm-pca/get-certificate-authority-certificate.rst @@ -1,5 +1,5 @@ -**To retrieve a certificate authority (CA) certificate** - -The ``get-certificate-authority-certificate`` command retrieves the certificate and certificate chain for your private CA:: - - aws acm-pca get-certificate-authority-certificate --certificate-authority-arn arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 --output text \ No newline at end of file +**To retrieve a certificate authority (CA) certificate** + +The following ``get-certificate-authority-certificate`` command retrieves the certificate and certificate chain for the private CA specified by the ARN. :: + + aws acm-pca get-certificate-authority-certificate --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 --output text \ No newline at end of file diff --git a/awscli/examples/acm-pca/get-certificate-authority-csr.rst b/awscli/examples/acm-pca/get-certificate-authority-csr.rst index 78e574257b2a..a18c734cb6ca 100644 --- a/awscli/examples/acm-pca/get-certificate-authority-csr.rst +++ b/awscli/examples/acm-pca/get-certificate-authority-csr.rst @@ -1,5 +1,5 @@ -**To retrieve the certificate signing request for a certificate authority** - -The ``get-certificate-authority-csr`` command retrieves the CSR for your private CA:: - - aws acm-pca get-certificate-authority-csr --certificate-authority-arn arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 --output text \ No newline at end of file +**To retrieve the certificate signing request for a certificate authority** + +The following ``get-certificate-authority-csr`` command retrieves the CSR for the private CA specified by the ARN. :: + + aws acm-pca get-certificate-authority-csr --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 --output text \ No newline at end of file diff --git a/awscli/examples/acm-pca/get-certificate.rst b/awscli/examples/acm-pca/get-certificate.rst index 63245adbc8fd..272363acc8d1 100644 --- a/awscli/examples/acm-pca/get-certificate.rst +++ b/awscli/examples/acm-pca/get-certificate.rst @@ -1,5 +1,5 @@ -**To retrieve an issued certificate** - -The ``get-certificate`` command retrieves a base64 encoded PEM format certificate:: - - aws acm-pca get-certificate --certificate-authority-arn arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 --certificate-arn arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012/certificate/6707447683a9b7f4055627ffd55cebcc --output text \ No newline at end of file +**To retrieve an issued certificate** + +The following ``get-certificate`` command retrieves a base64 encoded PEM format certificate. :: + + aws acm-pca get-certificate --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 --certificate-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012/certificate/6707447683a9b7f4055627ffd55cebcc --output text \ No newline at end of file diff --git a/awscli/examples/acm-pca/import-certificate-authority-certificate.rst b/awscli/examples/acm-pca/import-certificate-authority-certificate.rst index 54fd8f7cdbad..e197b7c546dd 100644 --- a/awscli/examples/acm-pca/import-certificate-authority-certificate.rst +++ b/awscli/examples/acm-pca/import-certificate-authority-certificate.rst @@ -1,5 +1,5 @@ -**To import your certificate authority certificate into ACM PCA** - -The ``import-certificate-authority-certificate`` command imports your signed private CA certificate into ACM PCA:: - - aws acm-pca import-certificate-authority-certificate --certificate-authority-arn arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 --certificate file://C:\ca_cert.pem --certificate-chain file://C:\ca_cert_chain.pem \ No newline at end of file +**To import your certificate authority certificate into ACM PCA** + +The following ``import-certificate-authority-certificate`` command imports the signed private CA certificate for the CA specified by the ARN into ACM PCA. :: + + aws acm-pca import-certificate-authority-certificate --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 --certificate file://C:\ca_cert.pem --certificate-chain file://C:\ca_cert_chain.pem \ No newline at end of file diff --git a/awscli/examples/acm-pca/issue-certificate.rst b/awscli/examples/acm-pca/issue-certificate.rst index 330de9ea23a3..c12c37fd93b0 100644 --- a/awscli/examples/acm-pca/issue-certificate.rst +++ b/awscli/examples/acm-pca/issue-certificate.rst @@ -1,5 +1,5 @@ -**To issue a private certificate** - -The ``issue-certificate`` command uses your private CA to issue a private certificate:: - - aws acm-pca issue-certificate --certificate-authority-arn arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 --csr file://C:\cert_1.csr --signing-algorithm "SHA256WITHRSA" --validity Value=365,Type="DAYS" --idempotency-token 1234 \ No newline at end of file +**To issue a private certificate** + +The following ``issue-certificate`` command uses the private CA specified by the ARN to issue a private certificate. :: + + aws acm-pca issue-certificate --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 --csr file://C:\cert_1.csr --signing-algorithm "SHA256WITHRSA" --validity Value=365,Type="DAYS" --idempotency-token 1234 \ No newline at end of file diff --git a/awscli/examples/acm-pca/list-certificate-authorities.rst b/awscli/examples/acm-pca/list-certificate-authorities.rst index 1b84d8dffa1e..8a43d121bc29 100644 --- a/awscli/examples/acm-pca/list-certificate-authorities.rst +++ b/awscli/examples/acm-pca/list-certificate-authorities.rst @@ -1,5 +1,5 @@ -**To list your private certificate authorities** - -The ``list-certificate-authorities`` command lists information about all of the private CAs in your account:: - +**To list your private certificate authorities** + +The following ``list-certificate-authorities`` command lists information about all of the private CAs in your account. :: + aws acm-pca list-certificate-authorities --max-results 10 \ No newline at end of file diff --git a/awscli/examples/acm-pca/list-tags.rst b/awscli/examples/acm-pca/list-tags.rst index fc1eb995c8ce..2ec192d5e0a7 100644 --- a/awscli/examples/acm-pca/list-tags.rst +++ b/awscli/examples/acm-pca/list-tags.rst @@ -1,5 +1,5 @@ -**To list the tags for your certificate authority** - -The ``list-tags`` command lists the tags associated with your private CA:: - - aws acm-pca list-tags --certificate-authority-arn arn:aws:acm-pca:region:account:certificate-authority/123455678-1234-1234-1234-123456789012 --max-results 10 \ No newline at end of file +**To list the tags for your certificate authority** + +The following ``list-tags`` command lists the tags associated with the private CA specified by the ARN. :: + + aws acm-pca list-tags --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/123455678-1234-1234-1234-123456789012 --max-results 10 \ No newline at end of file diff --git a/awscli/examples/acm-pca/revoke-certificate.rst b/awscli/examples/acm-pca/revoke-certificate.rst index 8b6e72723b1f..6786d7b27d55 100644 --- a/awscli/examples/acm-pca/revoke-certificate.rst +++ b/awscli/examples/acm-pca/revoke-certificate.rst @@ -1,5 +1,5 @@ -**To revoke a private certificate** - -The ``revoke-certificate`` command revokes a private certificate:: - - aws acm-pca revoke-certificate --certificate-authority-arn arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 --certificate-serial 67:07:44:76:83:a9:b7:f4:05:56:27:ff:d5:5c:eb:cc --revocation-reason "KEY_COMPROMISE" \ No newline at end of file +**To revoke a private certificate** + +The following ``revoke-certificate`` command revokes a private certificate from the CA identified by the ARN. :: + + aws acm-pca revoke-certificate --certificate-authority-arn arn:aws:acm-pca:us-west-2:1234567890:certificate-authority/12345678-1234-1234-1234-123456789012 --certificate-serial 67:07:44:76:83:a9:b7:f4:05:56:27:ff:d5:5c:eb:cc --revocation-reason "KEY_COMPROMISE" \ No newline at end of file diff --git a/awscli/examples/acm-pca/tag-certificate-authority.rst b/awscli/examples/acm-pca/tag-certificate-authority.rst index 7520b727e715..161f0617c34d 100644 --- a/awscli/examples/acm-pca/tag-certificate-authority.rst +++ b/awscli/examples/acm-pca/tag-certificate-authority.rst @@ -1,5 +1,5 @@ -**To attach tags to a private certificate authority** - -The ``tag-certificate-authority`` command attaches one or more tags to your private CA:: - - aws acm-pca tag-certificate-authority --certificate-authority-arn arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 --tags Key=Admin,Value=Alice \ No newline at end of file +**To attach tags to a private certificate authority** + +The following ``tag-certificate-authority`` command attaches one or more tags to your private CA. :: + + aws acm-pca tag-certificate-authority --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 --tags Key=Admin,Value=Alice \ No newline at end of file diff --git a/awscli/examples/acm-pca/untag-certificate-authority.rst b/awscli/examples/acm-pca/untag-certificate-authority.rst index 42014b20021a..8292a510c678 100644 --- a/awscli/examples/acm-pca/untag-certificate-authority.rst +++ b/awscli/examples/acm-pca/untag-certificate-authority.rst @@ -1,5 +1,5 @@ -**To remove one or more tags from your private certificate authority** - -The ``untag-certificate-authority`` command removes tags from your private CA:: - - aws acm-pca untag-certificate-authority --certificate-authority-arn arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 --tags Key=Purpose,Value=Website \ No newline at end of file +**To remove one or more tags from your private certificate authority** + +The following ``untag-certificate-authority`` command removes tags from the private CA identified by the ARN. :: + + aws acm-pca untag-certificate-authority --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 --tags Key=Purpose,Value=Website \ No newline at end of file diff --git a/awscli/examples/acm-pca/update-certificate-authority.rst b/awscli/examples/acm-pca/update-certificate-authority.rst index 326e6e8c6e2a..962057e237c8 100644 --- a/awscli/examples/acm-pca/update-certificate-authority.rst +++ b/awscli/examples/acm-pca/update-certificate-authority.rst @@ -1,5 +1,5 @@ -**To update the configuration of your private certificate authority** - -The ``update-certificate-authority`` command updates the status and configuration of your private CA:: - - aws acm-pca update-certificate-authority --certificate-authority-arn arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-1232456789012 --revocation-configuration file://C:\revoke_config.txt --status "DISABLED" \ No newline at end of file +**To update the configuration of your private certificate authority** + +The following ``update-certificate-authority`` command updates the status and configuration of the private CA identified by the ARN. :: + + aws acm-pca update-certificate-authority --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-1232456789012 --revocation-configuration file://C:\revoke_config.txt --status "DISABLED" \ No newline at end of file diff --git a/awscli/examples/codebuild/batch-delete-builds.rst b/awscli/examples/codebuild/batch-delete-builds.rst new file mode 100644 index 000000000000..6b94a52b6245 --- /dev/null +++ b/awscli/examples/codebuild/batch-delete-builds.rst @@ -0,0 +1,22 @@ +**To delete builds in AWS CodeBuild.** + +The following ``batch-delete-builds`` example deletes builds in CodeBuild with the specified IDs. :: + + aws codebuild batch-delete-builds --ids my-build-project-one:a1b2c3d4-5678-9012-abcd-11111EXAMPLE my-build-project-two:a1b2c3d4-5678-9012-abcd-22222EXAMPLE + +Output:: + + { + "buildsNotDeleted": [ + { + "id": "arn:aws:codebuild:us-west-2:123456789012:build/my-build-project-one:a1b2c3d4-5678-9012-abcd-11111EXAMPLE", + "statusCode": "BUILD_IN_PROGRESS" + } + ], + "buildsDeleted": [ + "arn:aws:codebuild:us-west-2:123456789012:build/my-build-project-two:a1b2c3d4-5678-9012-abcd-22222EXAMPLE" + ] + } + +For more information, see `Delete Builds (AWS CLI) `_ in the *AWS CodeBuild User Guide*. + diff --git a/awscli/examples/codebuild/batch-get-builds.rst b/awscli/examples/codebuild/batch-get-builds.rst new file mode 100644 index 000000000000..80e00f20a4ca --- /dev/null +++ b/awscli/examples/codebuild/batch-get-builds.rst @@ -0,0 +1,369 @@ +**To view details of builds in AWS CodeBuild.** + +The following ``batch-get-builds`` example gets information about builds in CodeBuild with the specified IDs. :: + + aws codebuild batch-get-builds --ids codebuild-demo-project:e9c4f4df-3f43-41d2-ab3a-60fe2EXAMPLE codebuild-demo-project:815e755f-bade-4a7e-80f0-efe51EXAMPLE + +Output:: + + { + "buildsNotFound": [], + "builds": [ + { + "artifacts": { + "md5sum": "0e95edf915048a0c22efe6d139fff837", + "location": "arn:aws:s3:::codepipeline-us-west-2-820783811474/CodeBuild-Python-Pip/BuildArtif/6DJsqQa", + "encryptionDisabled": false, + "sha256sum": "cfa0df33a090966a737f64ae4fe498969fdc842a0c9aec540bf93c37ac0d05a2" + }, + "logs": { + "cloudWatchLogs": { + "status": "ENABLED" + }, + "s3Logs": { + "status": "DISABLED" + }, + "streamName": "46472baf-8f6b-43c2-9255-b3b963af2732", + "groupName": "/aws/codebuild/codebuild-demo-project", + "deepLink": "https://console.aws.amazon.com/cloudwatch/home?region=us-west-2#logEvent:group=/aws/codebuild/codebuild-demo-project;stream=46472baf-8f6b-43c2-9255-b3b963af2732" + }, + "timeoutInMinutes": 60, + "environment": { + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_MEDIUM", + "image": "aws/codebuild/windows-base:1.0", + "environmentVariables": [], + "type": "WINDOWS_CONTAINER" + }, + "projectName": "codebuild-demo-project", + "buildComplete": true, + "source": { + "gitCloneDepth": 1, + "insecureSsl": false, + "type": "CODEPIPELINE" + }, + "buildStatus": "SUCCEEDED", + "secondaryArtifacts": [], + "phases": [ + { + "durationInSeconds": 0, + "startTime": 1548717462.122, + "phaseType": "SUBMITTED", + "endTime": 1548717462.484, + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 0, + "startTime": 1548717462.484, + "phaseType": "QUEUED", + "endTime": 1548717462.775, + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 34, + "endTime": 1548717496.909, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548717462.775, + "phaseType": "PROVISIONING", + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 15, + "endTime": 1548717512.555, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548717496.909, + "phaseType": "DOWNLOAD_SOURCE", + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 0, + "endTime": 1548717512.734, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548717512.555, + "phaseType": "INSTALL", + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 0, + "endTime": 1548717512.924, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548717512.734, + "phaseType": "PRE_BUILD", + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 9, + "endTime": 1548717522.254, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548717512.924, + "phaseType": "BUILD", + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 3, + "endTime": 1548717525.498, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548717522.254, + "phaseType": "POST_BUILD", + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 9, + "endTime": 1548717534.646, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548717525.498, + "phaseType": "UPLOAD_ARTIFACTS", + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 2, + "endTime": 1548717536.846, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548717534.646, + "phaseType": "FINALIZING", + "phaseStatus": "SUCCEEDED" + }, + { + "startTime": 1548717536.846, + "phaseType": "COMPLETED" + } + ], + "startTime": 1548717462.122, + "encryptionKey": "arn:aws:kms:us-west-2:123456789012:alias/aws/s3", + "initiator": "codepipeline/CodeBuild-Pipeline", + "secondarySources": [], + "serviceRole": "arn:aws:iam::123456789012:role/service-role/my-codebuild-service-role", + "currentPhase": "COMPLETED", + "id": "codebuild-demo-project:e9c4f4df-3f43-41d2-ab3a-60fe2EXAMPLE", + "cache": { + "type": "NO_CACHE" + }, + "sourceVersion": "arn:aws:s3:::codepipeline-us-west-2-820783811474/CodeBuild-Python-Pip/SourceArti/1TspnN3.zip", + "endTime": 1548717536.846, + "arn": "arn:aws:codebuild:us-west-2:123456789012:build/codebuild-demo-project:e9c4f4df-3f43-41d2-ab3a-60fe2EXAMPLE", + "queuedTimeoutInMinutes": 480, + "resolvedSourceVersion": "f2194c1757bbdcb0f8f229254a4b3c8b27d43e0b" + }, + { + "artifacts": { + "md5sum": "", + "overrideArtifactName": false, + "location": "arn:aws:s3:::my-artifacts/codebuild-demo-project", + "encryptionDisabled": false, + "sha256sum": "" + }, + "logs": { + "cloudWatchLogs": { + "status": "ENABLED" + }, + "s3Logs": { + "status": "DISABLED" + }, + "streamName": "4dea3ca4-20ec-4898-b22a-a9eb9292775d", + "groupName": "/aws/codebuild/codebuild-demo-project", + "deepLink": "https://console.aws.amazon.com/cloudwatch/home?region=us-west-2#logEvent:group=/aws/codebuild/codebuild-demo-project;stream=4dea3ca4-20ec-4898-b22a-a9eb9292775d" + }, + "timeoutInMinutes": 60, + "environment": { + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_MEDIUM", + "image": "aws/codebuild/windows-base:1.0", + "environmentVariables": [], + "type": "WINDOWS_CONTAINER" + }, + "projectName": "codebuild-demo-project", + "buildComplete": true, + "source": { + "gitCloneDepth": 1, + "location": "https://github.com/my-repo/codebuild-demo-project.git", + "insecureSsl": false, + "reportBuildStatus": false, + "type": "GITHUB" + }, + "buildStatus": "SUCCEEDED", + "secondaryArtifacts": [], + "phases": [ + { + "durationInSeconds": 0, + "startTime": 1548716241.89, + "phaseType": "SUBMITTED", + "endTime": 1548716242.241, + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 0, + "startTime": 1548716242.241, + "phaseType": "QUEUED", + "endTime": 1548716242.536, + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 33, + "endTime": 1548716276.171, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548716242.536, + "phaseType": "PROVISIONING", + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 15, + "endTime": 1548716291.809, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548716276.171, + "phaseType": "DOWNLOAD_SOURCE", + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 0, + "endTime": 1548716291.993, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548716291.809, + "phaseType": "INSTALL", + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 0, + "endTime": 1548716292.191, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548716291.993, + "phaseType": "PRE_BUILD", + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 9, + "endTime": 1548716301.622, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548716292.191, + "phaseType": "BUILD", + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 3, + "endTime": 1548716304.783, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548716301.622, + "phaseType": "POST_BUILD", + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 8, + "endTime": 1548716313.775, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548716304.783, + "phaseType": "UPLOAD_ARTIFACTS", + "phaseStatus": "SUCCEEDED" + }, + { + "durationInSeconds": 2, + "endTime": 1548716315.935, + "contexts": [ + { + "statusCode": "", + "message": "" + } + ], + "startTime": 1548716313.775, + "phaseType": "FINALIZING", + "phaseStatus": "SUCCEEDED" + }, + { + "startTime": 1548716315.935, + "phaseType": "COMPLETED" + } + ], + "startTime": 1548716241.89, + "secondarySourceVersions": [], + "initiator": "my-codebuild-project", + "arn": "arn:aws:codebuild:us-west-2:123456789012:build/codebuild-demo-project:815e755f-bade-4a7e-80f0-efe51EXAMPLE", + "encryptionKey": "arn:aws:kms:us-west-2:123456789012:alias/aws/s3", + "serviceRole": "arn:aws:iam::123456789012:role/service-role/my-codebuild-service-role", + "currentPhase": "COMPLETED", + "id": "codebuild-demo-project:815e755f-bade-4a7e-80f0-efe51EXAMPLE", + "cache": { + "type": "NO_CACHE" + }, + "endTime": 1548716315.935, + "secondarySources": [], + "queuedTimeoutInMinutes": 480, + "resolvedSourceVersion": "f2194c1757bbdcb0f8f229254a4b3c8b27d43e0b" + } + ] + } + +For more information, see `View Build Details (AWS CLI) `_ in the *AWS CodeBuild User Guide*. + diff --git a/awscli/examples/codebuild/batch-get-projects.rst b/awscli/examples/codebuild/batch-get-projects.rst new file mode 100644 index 000000000000..b54ff61c147b --- /dev/null +++ b/awscli/examples/codebuild/batch-get-projects.rst @@ -0,0 +1,89 @@ +**To get a list of AWS CodeBuild build project names.** + +The following ``batch-get-projects`` example gets a list of CodeBuild build projects specified by name. :: + + aws codebuild batch-get-projects --names codebuild-demo-project codebuild-demo-project2 my-other-demo-project + +In the following output, the ``projectsNotFound`` array lists any build project names that were specified, but not found. The ``projects`` array lists details for each build project where information was found. :: + + { + "projectsNotFound": [], + "projects": [ + { + "encryptionKey": "arn:aws:kms:us-west-2:123456789012:alias/aws/s3", + "name": "codebuild-demo-project2", + "queuedTimeoutInMinutes": 480, + "timeoutInMinutes": 60, + "source": { + "buildspec": "version: 0.2\n\n#env:\n #variables:\n # key: \"value\"\n # key: \"value\"\n #parameter-store:\n # key: \"value\"\n # key:\"value\"\n\nphases:\n #install:\n #commands:\n # - command\n # - command\n #pre_build:\n #commands:\n # - command\n # - command\n build:\n commands:\n # - command\n # - command\n #post_build:\n #commands:\n # - command\n # - command\n#artifacts:\n #files:\n # - location\n # - location\n #name: $(date +%Y-%m-%d)\n #discard-paths: yes\n #base-directory: location\n#cache:\n #paths:\n # - paths", + "type": "NO_SOURCE", + "insecureSsl": false, + "gitCloneDepth": 1 + }, + "artifacts": { + "type": "NO_ARTIFACTS" + }, + "badge": { + "badgeEnabled": false + }, + "lastModified": 1540588091.108, + "created": 1540588091.108, + "arn": "arn:aws:codebuild:us-west-2:123456789012:project/test-for-sample", + "secondarySources": [], + "secondaryArtifacts": [], + "cache": { + "type": "NO_CACHE" + }, + "serviceRole": "arn:aws:iam::123456789012:role/service-role/my-test-role", + "environment": { + "image": "aws/codebuild/java:openjdk-8", + "privilegedMode": true, + "type": "LINUX_CONTAINER", + "computeType": "BUILD_GENERAL1_SMALL", + "environmentVariables": [] + }, + "tags": [] + }, + { + "encryptionKey": "arn:aws:kms:us-west-2:123456789012:alias/aws/s3", + "name": "my-other-demo-project", + "queuedTimeoutInMinutes": 480, + "timeoutInMinutes": 60, + "source": { + "location": "https://github.com/iversonic/codedeploy-sample.git", + "reportBuildStatus": false, + "buildspec": "buildspec.yml", + "insecureSsl": false, + "gitCloneDepth": 1, + "type": "GITHUB", + "auth": { + "type": "OAUTH" + } + }, + "artifacts": { + "type": "NO_ARTIFACTS" + }, + "badge": { + "badgeEnabled": false + }, + "lastModified": 1523401711.73, + "created": 1523401711.73, + "arn": "arn:aws:codebuild:us-west-2:123456789012:project/Project2", + "cache": { + "type": "NO_CACHE" + }, + "serviceRole": "arn:aws:iam::123456789012:role/service-role/codebuild-Project2-service-role", + "environment": { + "image": "aws/codebuild/nodejs:4.4.7", + "privilegedMode": false, + "type": "LINUX_CONTAINER", + "computeType": "BUILD_GENERAL1_SMALL", + "environmentVariables": [] + }, + "tags": [] + } + ] + } + +For more information, see `View a Build Project's Details (AWS CLI) `_ in the *AWS CodeBuild User Guide*. + diff --git a/awscli/examples/codebuild/create-project.rst b/awscli/examples/codebuild/create-project.rst new file mode 100755 index 000000000000..b8f24fcf10ef --- /dev/null +++ b/awscli/examples/codebuild/create-project.rst @@ -0,0 +1,112 @@ +**Example 1: To create an AWS CodeBuild build project** + +The following ``create-project`` example creates a CodeBuild build project using source files from an S3 bucket. :: + + aws codebuild create-project \ + --name "my-demo-project" \ + --source "{\"type\": \"S3\",\"location\": \"codebuild-us-west-2-123456789012-input-bucket/my-source.zip\"}" \ + --artifacts {"\"type\": \"S3\",\"location\": \"codebuild-us-west-2-123456789012-output-bucket\""} \ + --environment "{\"type\": \"LINUX_CONTAINER\",\"image\": \"aws/codebuild/standard:1.0\",\"computeType\": \"BUILD_GENERAL1_SMALL\"}" \ + --service-role "arn:aws:iam::123456789012:role/service-role/my-codebuild-service-role" + +Output:: + + { + "project": { + "arn": "arn:aws:codebuild:us-west-2:123456789012:project/my-demo-project", + "name": "my-cli-demo-project", + "encryptionKey": "arn:aws:kms:us-west-2:123456789012:alias/aws/s3", + "serviceRole": "arn:aws:iam::123456789012:role/service-role/my-codebuild-service-role", + "lastModified": 1556839783.274, + "badge": { + "badgeEnabled": false + }, + "queuedTimeoutInMinutes": 480, + "environment": { + "image": "aws/codebuild/standard:1.0", + "computeType": "BUILD_GENERAL1_SMALL", + "type": "LINUX_CONTAINER", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "environmentVariables": [] + }, + "artifacts": { + "location": "codebuild-us-west-2-123456789012-output-bucket", + "name": "my-cli-demo-project", + "namespaceType": "NONE", + "type": "S3", + "packaging": "NONE", + "encryptionDisabled": false + }, + "source": { + "type": "S3", + "location": "codebuild-us-west-2-123456789012-input-bucket/my-source.zip", + "insecureSsl": false + }, + "timeoutInMinutes": 60, + "cache": { + "type": "NO_CACHE" + }, + "created": 1556839783.274 + } + } + +**Example 2: To create an AWS CodeBuild build project using a JSON input file for the parameters** + +The following ``create-project`` example creates a CodeBuild build project by passing all of the required parameters in a JSON input file. Create the input file template by running the command with only the ``--generate-cli-skeleton parameter``. :: + + aws codebuild create-project --cli-input-json file://create-project.json + +The input JSON file ``create-project.json`` contains the following content: + + { + "name": "codebuild-demo-project", + "source": { + "type": "S3", + "location": "codebuild-region-ID-account-ID-input-bucket/MessageUtil.zip" + }, + "artifacts": { + "type": "S3", + "location": "codebuild-region-ID-account-ID-output-bucket" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:1.0", + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": "serviceIAMRole" + } + +Output:: + + { + "project": { + "name": "codebuild-demo-project", + "serviceRole": "serviceIAMRole", + "tags": [], + "artifacts": { + "packaging": "NONE", + "type": "S3", + "location": "codebuild-region-ID-account-ID-output-bucket", + "name": "message-util.zip" + }, + "lastModified": 1472661575.244, + "timeoutInMinutes": 60, + "created": 1472661575.244, + "environment": { + "computeType": "BUILD_GENERAL1_SMALL", + "image": "aws/codebuild/standard:1.0", + "type": "LINUX_CONTAINER", + "environmentVariables": [] + }, + "source": { + "type": "S3", + "location": "codebuild-region-ID-account-ID-input-bucket/MessageUtil.zip" + }, + "encryptionKey": "arn:aws:kms:region-ID:account-ID:alias/aws/s3", + "arn": "arn:aws:codebuild:region-ID:account-ID:project/codebuild-demo-project" + } + } + +For more information, see `Create a Build Project (AWS CLI) `_ in the *AWS CodeBuild User Guide*. + diff --git a/awscli/examples/codebuild/create-webhook.rst b/awscli/examples/codebuild/create-webhook.rst new file mode 100755 index 000000000000..449fcd38e617 --- /dev/null +++ b/awscli/examples/codebuild/create-webhook.rst @@ -0,0 +1,50 @@ +**To create webhook filters for an AWS CodeBuild project** + +The following ``create-webhook`` example creates a webhook for a CodeBuild project named ``my-project`` that has two filter groups. The first filter group specifies pull requests that are created, updated, or reopened on branches with Git reference names that match the regular expression ``^refs/heads/master$`` and head references that match ``^refs/heads/myBranch$``. The second filter group specifies push requests on branches with Git reference names that do not match the regular expression ``^refs/heads/myBranch$``. :: + + aws codebuild create-webhook \ + --project-name my-project \ + --filter-groups "[[{\"type\":\"EVENT\",\"pattern\":\"PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED, PULL_REQUEST_REOPENED\"},{\"type\":\"HEAD_REF\",\"pattern\":\"^refs/heads/myBranch$\",\"excludeMatchedPattern\":true},{\"type\":\"BASE_REF\",\"pattern\":\"^refs/heads/master$\",\"excludeMatchedPattern\":true}],[{\"type\":\"EVENT\",\"pattern\":\"PUSH\"},{\"type\":\"HEAD_REF\",\"pattern\":\"^refs/heads/myBranch$\",\"excludeMatchedPattern\":true}]]" + +Output:: + + { + "webhook": { + "payloadUrl": "https://codebuild.us-west-2.amazonaws.com/webhooks?t=eyJlbmNyeXB0ZWREYXRhIjoiVVl5MGtoeGRwSzZFRXl2Wnh4bld1Z0tKZ291TVpQNEtFamQ3RDlDYWpRaGIreVFrdm9EQktIVk1NeHJEWEpmUDUrVUNOMUIyRHJRc1VxcHJ6QlNDSnljPSIsIml2UGFyYW1ldGVyU3BlYyI6InN4Tm1SeUt5MUhaUVRWbGciLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&v=1", + "url": "https://api.github.com/repos/iversonic/codedeploy-sample/hooks/105190656", + "lastModifiedSecret": 1556311319.069, + "filterGroups": [ + [ + { + "type": "EVENT", + "pattern": "PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED, PULL_REQUEST_REOPENED", + "excludeMatchedPattern": false + }, + { + "type": "HEAD_REF", + "pattern": "refs/heads/myBranch$", + "excludeMatchedPattern": true + }, + { + "type": "BASE_REF", + "pattern": "refs/heads/master$", + "excludeMatchedPattern": true + } + ], + [ + { + "type": "EVENT", + "pattern": "PUSH", + "excludeMatchedPattern": false + }, + { + "type": "HEAD_REF", + "pattern": "refs/heads/myBranch$", + "excludeMatchedPattern": true + } + ] + ] + } + } + +For more information, see `Filter GitHub Webhook Events (SDK) `_ in the *AWS CodeBuild User Guide*. diff --git a/awscli/examples/codebuild/delete-project.rst b/awscli/examples/codebuild/delete-project.rst new file mode 100755 index 000000000000..6260cabe4d73 --- /dev/null +++ b/awscli/examples/codebuild/delete-project.rst @@ -0,0 +1,9 @@ +**To delete an AWS CodeBuild build project** + +The following ``delete-project`` example deletes the specified CodeBuild build project. :: + + aws codebuild delete-project --name my-project + +This command produces no output. + +For more information, see `Delete a Build Project (AWS CLI) `_ in the *AWS CodeBuild User Guide*. diff --git a/awscli/examples/codebuild/delete-source-credentials.rst b/awscli/examples/codebuild/delete-source-credentials.rst new file mode 100755 index 000000000000..3d303364218f --- /dev/null +++ b/awscli/examples/codebuild/delete-source-credentials.rst @@ -0,0 +1,13 @@ +**To disconnect from a source provider and remove its access tokens.** + +The following ``delete-source-credentials`` example disconnects from a source provider and removes its tokens. The ARN of source credentials used to connect to the source provider determines which source credentials. :: + + aws codebuild delete-source-credentials --arn arn-of-your-credentials + +Output:: + + { + "arn": "arn:aws:codebuild:your-region:your-account-id:token/your-server-type" + } + +For more information, see `Connect Source Providers with Access Tokens (CLI) `_ in the *AWS CodeBuild User Guide*. diff --git a/awscli/examples/codebuild/delete-webhook.rst b/awscli/examples/codebuild/delete-webhook.rst new file mode 100755 index 000000000000..b5f0afd2351c --- /dev/null +++ b/awscli/examples/codebuild/delete-webhook.rst @@ -0,0 +1,9 @@ +**To delete a webhook filter from an AWS CodeBuild project** + +The following ``delete-webhook`` example deletes a webhook from the specified CodeBuild project. :: + + aws codebuild delete-webhook --project-name my-project + +This command produces no output. + +For more information, see `Stop Running Builds Automatically (AWS CLI) `_ in the *AWS CodeBuild User Guide*. diff --git a/awscli/examples/codebuild/import-source-credentials.rst b/awscli/examples/codebuild/import-source-credentials.rst new file mode 100755 index 000000000000..69b0f186b96a --- /dev/null +++ b/awscli/examples/codebuild/import-source-credentials.rst @@ -0,0 +1,13 @@ +**Connect an AWS CodeBuild user to a source provider by importing credentials for the source provider.** + +The following ``import-source-credentials`` example imports a token for a Bitbucket repository that uses BASIC_AUTH for its authentication type. :: + + aws codebuild import-source-credentials --server-type BITBUCKET --auth-type BASIC_AUTH --token my-Bitbucket-password --username my-Bitbucket-username + +Output:: + + { + "arn": "arn:aws:codebuild:us-west-2:123456789012:token/bitbucket" + } + +For more information, see `Connect Source Providers with Access Tokens (CLI) `_ in the *AWS CodeBuild User Guide*. diff --git a/awscli/examples/codebuild/invalidate-project-cache.rst b/awscli/examples/codebuild/invalidate-project-cache.rst new file mode 100755 index 000000000000..26436b1dd9ce --- /dev/null +++ b/awscli/examples/codebuild/invalidate-project-cache.rst @@ -0,0 +1,9 @@ +**To reset the cache for an AWS CodeBuild build project.** + +The following ``invalidate-project-cache`` example resets the cache for the specified CodeBuild project. :: + + aws codebuild invalidate-project-cache --project-name my-project + +This command produces no output. + +For more information, see `Build Caching in CodeBuild `_ in the *AWS CodeBuild User Guide*. diff --git a/awscli/examples/codebuild/list-builds-for-project.rst b/awscli/examples/codebuild/list-builds-for-project.rst new file mode 100755 index 000000000000..4db3478f7ebd --- /dev/null +++ b/awscli/examples/codebuild/list-builds-for-project.rst @@ -0,0 +1,19 @@ +**To view a list of builds for an AWS CodeBuild build project.** + +The following ``list-builds-for-project`` example lists the build IDs in descending order for the specified CodeBuild build project. :: + + aws codebuild list-builds-for-project --project-name codebuild-demo-project --sort-order DESCENDING + +Output:: + + { + "ids": [ + "codebuild-demo-project:1a2b3c4d-5678-90ab-cdef-11111example", + "codebuild-demo-project:1a2b3c4d-5678-90ab-cdef-22222example", + "codebuild-demo-project:1a2b3c4d-5678-90ab-cdef-33333example", + "codebuild-demo-project:1a2b3c4d-5678-90ab-cdef-44444example", + "codebuild-demo-project:1a2b3c4d-5678-90ab-cdef-55555example" + ] + } + +For more information, see `View a List of Build IDs for a Build Project (AWS CLI) `_ in the *AWS CodeBuild User Guide* diff --git a/awscli/examples/codebuild/list-builds.rst b/awscli/examples/codebuild/list-builds.rst new file mode 100755 index 000000000000..d9ae898fa328 --- /dev/null +++ b/awscli/examples/codebuild/list-builds.rst @@ -0,0 +1,35 @@ +**To get a list of AWS CodeBuild builds IDs.** + +The following ``list-builds`` example gets a list of CodeBuild IDs sorted in ascending order. :: + + aws codebuild list-builds --sort-order ASCENDING + +The output includes a ``nextToken`` value which indicates that there is more output available. :: + + { + "nextToken": "4AEA6u7J...The full token has been omitted for brevity...MzY2OA==", + "ids": [ + "codebuild-demo-project:815e755f-bade-4a7e-80f0-efe51EXAMPLE" + "codebuild-demo-project:84a7f3d1-d40e-4956-b4cf-7a9d4EXAMPLE" + ... The full list of build IDs has been omitted for brevity ... + "codebuild-demo-project:931d0b72-bf6f-4040-a472-5c707EXAMPLE" + ] + } + +Run this command again and provide the ``nextToken`` value in the previous response as a parameter to get the next part of the output. Repeat until you don't receive a ``nextToken`` value in the response. :: + + aws codebuild list-builds --sort-order ASCENDING --next-token 4AEA6u7J...The full token has been omitted for brevity...MzY2OA== + +Next part of the output:: + + { + "ids": [ + "codebuild-demo-project:49015049-21cf-4b50-9708-df115EXAMPLE", + "codebuild-demo-project:543e7206-68a3-46d6-a4da-759abEXAMPLE", + ... The full list of build IDs has been omitted for brevity ... + "codebuild-demo-project:c282f198-4582-4b38-bdc0-26f96EXAMPLE" + ] + } + +For more information, see `View a List of Build IDs (AWS CLI) `_ in the *AWS CodeBuild User Guide* + diff --git a/awscli/examples/codebuild/list-curated-environment-images.rst b/awscli/examples/codebuild/list-curated-environment-images.rst new file mode 100755 index 000000000000..f1b975a17555 --- /dev/null +++ b/awscli/examples/codebuild/list-curated-environment-images.rst @@ -0,0 +1,40 @@ +**To get a list of Docker images managed by AWS CodeBuild that you can use for your builds.** + +The following ``list-curated-environment-images`` example lists the Docker images managed by CodeBuild that can be used for builds.:: + + aws codebuild list-curated-environment-images + +Output:: + + { + "platforms": [ + { + "platform": "AMAZON_LINUX", + "languages": [ + { + "language": "JAVA", + "images": [ + { + "description": "AWS ElasticBeanstalk - Java 7 Running on Amazon Linux 64bit v2.1.3", + "name": "aws/codebuild/eb-java-7-amazonlinux-64:2.1.3", + "versions": [ + "aws/codebuild/eb-java-7-amazonlinux-64:2.1.3-1.0.0" + ] + }, + { + "description": "AWS ElasticBeanstalk - Java 8 Running on Amazon Linux 64bit v2.1.3", + "name": "aws/codebuild/eb-java-8-amazonlinux-64:2.1.3", + "versions": [ + "aws/codebuild/eb-java-8-amazonlinux-64:2.1.3-1.0.0" + ] + }, + ... LIST TRUNCATED FOR BREVITY ... + ] + } + ] + } + ] + } + + +For more information, see `Docker Images Provided by CodeBuild `_ in the *AWS CodeBuild User Guide* diff --git a/awscli/examples/codebuild/list-projects.rst b/awscli/examples/codebuild/list-projects.rst new file mode 100755 index 000000000000..13e7f903b1d3 --- /dev/null +++ b/awscli/examples/codebuild/list-projects.rst @@ -0,0 +1,33 @@ +**To get a list of AWS CodeBuild build project names.** + +The following ``list-projects`` example gets a list of CodeBuild build projects sorted by name in ascending order. :: + + aws codebuild list-projects --sort-by NAME --sort-order ASCENDING + +The output includes a ``nextToken`` value which indicates that there is more output available. :: + + { + "nextToken": "Ci33ACF6...The full token has been omitted for brevity...U+AkMx8=", + "projects": [ + "codebuild-demo-project", + "codebuild-demo-project2", + ... The full list of build project names has been omitted for brevity ... + "codebuild-demo-project99" + ] + } + +Run this command again and provide the ``nextToken`` value from the previous response as a parameter to get the next part of the output. Repeat until you don't receive a ``nextToken`` value in the response. :: + + aws codebuild list-projects --sort-by NAME --sort-order ASCENDING --next-token Ci33ACF6...The full token has been omitted for brevity...U+AkMx8= + + { + "projects": [ + "codebuild-demo-project100", + "codebuild-demo-project101", + ... The full list of build project names has been omitted for brevity ... + "codebuild-demo-project122" + ] + } + +For more information, see `View a List of Build Project Names (AWS CLI) `_ in the *AWS CodeBuild User Guide*. + diff --git a/awscli/examples/codebuild/list-source-credentials.rst b/awscli/examples/codebuild/list-source-credentials.rst new file mode 100755 index 000000000000..b8335262b99c --- /dev/null +++ b/awscli/examples/codebuild/list-source-credentials.rst @@ -0,0 +1,24 @@ +**To view a list of sourceCredentialsObjects. ** + +The following ``list-source-credentials`` example lists tokens for an AWS account connected to one Bitbucket account and one GitHub account. Each ``sourceCredentialsInfos`` object in the response contains connected source credentials information. :: + + aws codebuild list-source-credentials + +Output:: + + { + "sourceCredentialsInfos": [ + { + "serverType": "BITBUCKET", + "arn": "arn:aws:codebuild:us-west-2:123456789012:token/bitbucket", + "authType": "BASIC_AUTH" + }, + { + "serverType": "GITHUB", + "arn": "arn:aws:codebuild:us-west-2:123456789012:token/github", + "authType": "OAUTH" + } + ] + } + +For more information, see `Connect Source Providers with Access Tokens (CLI) `_ in the *AWS CodeBuild User Guide*. diff --git a/awscli/examples/codebuild/start-build.rst b/awscli/examples/codebuild/start-build.rst new file mode 100755 index 000000000000..b12d87fb1fef --- /dev/null +++ b/awscli/examples/codebuild/start-build.rst @@ -0,0 +1,66 @@ +**To start running a build of an AWS CodeBuild build project.** + +The following ``start-build`` example starts a build for the specified CodeBuild project. The build overrides both the project's setting for the number of minutes the build is allowed to be queued before it times out and the project's artifact settings. :: + + aws codebuild start-build \ + --project-name "my-demo-project" \ + --queued-timeout-in-minutes-override 5 \ + --artifacts-override {"\"type\": \"S3\",\"location\": \"arn:aws:s3:::artifacts-override\",\"overrideArtifactName\":true"} + +Output:: + + { + "build": { + "serviceRole": "arn:aws:iam::123456789012:role/service-role/my-codebuild-service-role", + "buildStatus": "IN_PROGRESS", + "buildComplete": false, + "projectName": "my-demo-project", + "timeoutInMinutes": 60, + "source": { + "insecureSsl": false, + "type": "S3", + "location": "codebuild-us-west-2-123456789012-input-bucket/my-source.zip" + }, + "queuedTimeoutInMinutes": 5, + "encryptionKey": "arn:aws:kms:us-west-2:123456789012:alias/aws/s3", + "currentPhase": "QUEUED", + "startTime": 1556905683.568, + "environment": { + "computeType": "BUILD_GENERAL1_MEDIUM", + "environmentVariables": [], + "type": "LINUX_CONTAINER", + "privilegedMode": false, + "image": "aws/codebuild/standard:1.0", + "imagePullCredentialsType": "CODEBUILD" + }, + "phases": [ + { + "phaseStatus": "SUCCEEDED", + "startTime": 1556905683.568, + "phaseType": "SUBMITTED", + "durationInSeconds": 0, + "endTime": 1556905684.524 + }, + { + "startTime": 1556905684.524, + "phaseType": "QUEUED" + } + ], + "logs": { + "deepLink": "https://console.aws.amazon.com/cloudwatch/home?region=us-west-2#logEvent:group=null;stream=null" + }, + "artifacts": { + "encryptionDisabled": false, + "location": "arn:aws:s3:::artifacts-override/my-demo-project", + "overrideArtifactName": true + }, + "cache": { + "type": "NO_CACHE" + }, + "id": "my-demo-project::12345678-a1b2-c3d4-e5f6-11111EXAMPLE", + "initiator": "my-aws-account-name", + "arn": "arn:aws:codebuild:us-west-2:123456789012:build/my-demo-project::12345678-a1b2-c3d4-e5f6-11111EXAMPLE" + } + } + +For more information, see `Run a Build (AWS CLI) `_ in the *AWS CodeBuild User Guide*. diff --git a/awscli/examples/codebuild/stop-build.rst b/awscli/examples/codebuild/stop-build.rst new file mode 100755 index 000000000000..0c519d8c022b --- /dev/null +++ b/awscli/examples/codebuild/stop-build.rst @@ -0,0 +1,132 @@ +**To stop a build of an AWS CodeBuild build project.** + +The following ``stop-build`` example stops the specified CodeBuild build. :: + + aws codebuild stop-build --id my-demo-project:12345678-a1b2-c3d4-e5f6-11111EXAMPLE + +Output:: + + { + "build": { + "startTime": 1556906956.318, + "initiator": "my-aws-account-name", + "projectName": "my-demo-project", + "currentPhase": "COMPLETED", + "cache": { + "type": "NO_CACHE" + }, + "source": { + "insecureSsl": false, + "location": "codebuild-us-west-2-123456789012-input-bucket/my-source.zip", + "type": "S3" + }, + "id": "my-demo-project:1a2b3c4d-5678-90ab-cdef-11111EXAMPLE", + "endTime": 1556906974.781, + "phases": [ + { + "durationInSeconds": 0, + "phaseType": "SUBMITTED", + "endTime": 1556906956.935, + "phaseStatus": "SUCCEEDED", + "startTime": 1556906956.318 + }, + { + "durationInSeconds": 1, + "phaseType": "QUEUED", + "endTime": 1556906958.272, + "phaseStatus": "SUCCEEDED", + "startTime": 1556906956.935 + }, + { + "phaseType": "PROVISIONING", + "phaseStatus": "SUCCEEDED", + "durationInSeconds": 14, + "contexts": [ + { + "message": "", + "statusCode": "" + } + ], + "endTime": 1556906972.847, + "startTime": 1556906958.272 + }, + { + "phaseType": "DOWNLOAD_SOURCE", + "phaseStatus": "SUCCEEDED", + "durationInSeconds": 0, + "contexts": [ + { + "message": "", + "statusCode": "" + } + ], + "endTime": 1556906973.552, + "startTime": 1556906972.847 + }, + { + "phaseType": "INSTALL", + "phaseStatus": "SUCCEEDED", + "durationInSeconds": 0, + "contexts": [ + { + "message": "", + "statusCode": "" + } + ], + "endTime": 1556906973.75, + "startTime": 1556906973.552 + }, + { + "phaseType": "PRE_BUILD", + "phaseStatus": "SUCCEEDED", + "durationInSeconds": 0, + "contexts": [ + { + "message": "", + "statusCode": "" + } + ], + "endTime": 1556906973.937, + "startTime": 1556906973.75 + }, + { + "durationInSeconds": 0, + "phaseType": "BUILD", + "endTime": 1556906974.781, + "phaseStatus": "STOPPED", + "startTime": 1556906973.937 + }, + { + "phaseType": "COMPLETED", + "startTime": 1556906974.781 + } + ], + "artifacts": { + "location": "arn:aws:s3:::artifacts-override/my-demo-project", + "encryptionDisabled": false, + "overrideArtifactName": true + }, + "buildComplete": true, + "buildStatus": "STOPPED", + "encryptionKey": "arn:aws:kms:us-west-2:123456789012:alias/aws/s3", + "serviceRole": "arn:aws:iam::123456789012:role/service-role/my-codebuild-service-role", + "queuedTimeoutInMinutes": 5, + "timeoutInMinutes": 60, + "environment": { + "type": "LINUX_CONTAINER", + "environmentVariables": [], + "computeType": "BUILD_GENERAL1_MEDIUM", + "privilegedMode": false, + "image": "aws/codebuild/standard:1.0", + "imagePullCredentialsType": "CODEBUILD" + }, + "logs": { + "streamName": "1a2b3c4d-5678-90ab-cdef-11111EXAMPLE", + "deepLink": "https://console.aws.amazon.com/cloudwatch/home?region=us-west-2#logEvent:group=/aws/codebuild/my-demo-project;stream=1a2b3c4d-5678-90ab-cdef-11111EXAMPLE", + "groupName": "/aws/codebuild/my-demo-project" + }, + "arn": "arn:aws:codebuild:us-west-2:123456789012:build/my-demo-project:1a2b3c4d-5678-90ab-cdef-11111EXAMPLE" + } + } + +For more information, see `Stop a Build (AWS CLI) `_ in the *AWS CodeBuild User Guide*. diff --git a/awscli/examples/codebuild/update-project.rst b/awscli/examples/codebuild/update-project.rst new file mode 100755 index 000000000000..aeee91a46eb6 --- /dev/null +++ b/awscli/examples/codebuild/update-project.rst @@ -0,0 +1,56 @@ +**To change an AWS CodeBuild build project's settings.** + +The following ``update-project`` example changes the settings of the specified CodeBuild build project named my-demo-project. :: + + aws codebuild update-project --name "my-demo-project" \ + --description "This project is updated" \ + --source "{\"type\": \"S3\",\"location\": \"codebuild-us-west-2-123456789012-input-bucket/my-source-2.zip\"}" \ + --artifacts {"\"type\": \"S3\",\"location\": \"codebuild-us-west-2-123456789012-output-bucket-2\""} \ + --environment "{\"type\": \"LINUX_CONTAINER\",\"image\": \"aws/codebuild/standard:1.0\",\"computeType\": \"BUILD_GENERAL1_MEDIUM\"}" \ + --service-role "arn:aws:iam::123456789012:role/service-role/my-codebuild-service-role" + +The output displays the updated settings. :: + + { + "project": { + "arn": "arn:aws:codebuild:us-west-2:123456789012:project/my-demo-project", + "environment": { + "privilegedMode": false, + "environmentVariables": [], + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:1.0", + "computeType": "BUILD_GENERAL1_MEDIUM", + "imagePullCredentialsType": "CODEBUILD" + }, + "queuedTimeoutInMinutes": 480, + "description": "This project is updated", + "artifacts": { + "packaging": "NONE", + "name": "my-demo-project", + "type": "S3", + "namespaceType": "NONE", + "encryptionDisabled": false, + "location": "codebuild-us-west-2-123456789012-output-bucket-2" + }, + "encryptionKey": "arn:aws:kms:us-west-2:123456789012:alias/aws/s3", + "badge": { + "badgeEnabled": false + }, + "serviceRole": "arn:aws:iam::123456789012:role/service-role/my-codebuild-service-role", + "lastModified": 1556840545.967, + "tags": [], + "timeoutInMinutes": 60, + "created": 1556839783.274, + "name": "my-demo-project", + "cache": { + "type": "NO_CACHE" + }, + "source": { + "type": "S3", + "insecureSsl": false, + "location": "codebuild-us-west-2-123456789012-input-bucket/my-source-2.zip" + } + } + } + +For more information, see `Change a Build Project's Settings (AWS CLI) `_ in the *AWS CodeBuild User Guide* diff --git a/awscli/examples/codebuild/update-webhook.rst b/awscli/examples/codebuild/update-webhook.rst new file mode 100755 index 000000000000..ff3db761894d --- /dev/null +++ b/awscli/examples/codebuild/update-webhook.rst @@ -0,0 +1,47 @@ +**To update the webhook for an AWS CodeBuild project** + +The following ``update-webhook`` example updates a webhook for the specified CodeBuild project with two filter groups. The ``--rotate-secret`` parameter specifies that GitHub rotate the project's secret key every time a code change triggers a build. The first filter group specifies pull requests that are created, updated, or reopened on branches with Git reference names that match the regular expression ``^refs/heads/master$`` and head references that match ``^refs/heads/myBranch$``. The second filter group specifies push requests on branches with Git reference names that do not match the regular expression ``^refs/heads/myBranch$``. :: + + aws codebuild update-webhook \ + --project-name Project2 \ + --rotate-secret \ + --filter-groups "[[{\"type\":\"EVENT\",\"pattern\":\"PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED, PULL_REQUEST_REOPENED\"},{\"type\":\"HEAD_REF\",\"pattern\":\"^refs/heads/myBranch$\",\"excludeMatchedPattern\":true},{\"type\":\"BASE_REF\",\"pattern\":\"^refs/heads/master$\",\"excludeMatchedPattern\":true}],[{\"type\":\"EVENT\",\"pattern\":\"PUSH\"},{\"type\":\"HEAD_REF\",\"pattern\":\"^refs/heads/myBranch$\",\"excludeMatchedPattern\":true}]]" + +Output:: + + { + "webhook": { + "filterGroups": [ + [ + { + "pattern": "PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED, PULL_REQUEST_REOPENED", + "type": "EVENT" + }, + { + "excludeMatchedPattern": true, + "pattern": "refs/heads/myBranch$", + "type": "HEAD_REF" + }, + { + "excludeMatchedPattern": true, + "pattern": "refs/heads/master$", + "type": "BASE_REF" + } + ], + [ + { + "pattern": "PUSH", + "type": "EVENT" + }, + { + "excludeMatchedPattern": true, + "pattern": "refs/heads/myBranch$", + "type": "HEAD_REF" + } + ] + ], + "lastModifiedSecret": 1556312220.133 + } + } + +For more information, see `Change a Build Project's Settings (AWS CLI) `_ in the *AWS CodeBuild User Guide* diff --git a/awscli/examples/codecommit/create-commit.rst b/awscli/examples/codecommit/create-commit.rst new file mode 100755 index 000000000000..61236319f28d --- /dev/null +++ b/awscli/examples/codecommit/create-commit.rst @@ -0,0 +1,25 @@ +**To create a commit** + +The following ``create-commit`` example demonstrates how to create an initial commit for a repository that adds a ``readme.md`` file to a repository named ``MyDemoRepo`` in the ``master`` branch. :: + + aws codecommit create-commit --repository-name MyDemoRepo --branch-name master --put-files "filePath=readme.md,fileContent='Welcome to our team repository.'" + +Output:: + + { + "filesAdded": [ + { + "blobId": "5e1c309d-EXAMPLE", + "absolutePath": "readme.md", + "fileMode": "NORMAL" + } + ], + "commitId": "4df8b524-EXAMPLE", + "treeId": "55b57003-EXAMPLE", + "filesDeleted": [], + "filesUpdated": [] + } + +For more information, see `Create a Commit in AWS CodeCommit`_ in the *AWS CodeCommit User Guide*. + +.. _`Create a Commit in AWS CodeCommit`: https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-create-commit.html#how-to-create-commit-cli \ No newline at end of file diff --git a/awscli/examples/codecommit/credential-helper.rst b/awscli/examples/codecommit/credential-helper.rst new file mode 100755 index 000000000000..017d93abb55c --- /dev/null +++ b/awscli/examples/codecommit/credential-helper.rst @@ -0,0 +1,18 @@ +**To set up the credential helper included in the AWS CLI with AWS CodeCommit** + +The ``credential-helper`` utility is not designed to be called directly from the AWS CLI. Instead it is intended to be used as a parameter with the ``git config`` command to set up your local computer. It enables Git to use HTTPS and a cryptographically signed version of your IAM user credentials or Amazon EC2 instance role whenever Git needs to authenticate with AWS to interact with CodeCommit repositories. :: + + git config --global credential.helper '!aws codecommit credential-helper $@' + git config --global credential.UseHttpPath true + +Output:: + + [credential] + helper = !aws codecommit credential-helper $@ + UseHttpPath = true + +For more information, see `Setting up for AWS CodeCommit Using Other Methods`_ in the *AWS CodeCommit User Guide*. Review the content carefully, and then follow the procedures in one of the following topics: `For HTTPS Connections on Linux, macOS, or Unix`_ or `For HTTPS Connections on Windows`_ in the *AWS CodeCommit User Guide*. + +.. _`Setting up for AWS CodeCommit Using Other Methods`: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up.html?shortFooter=true#setting-up-other +.. _`For HTTPS Connections on Linux, macOS, or Unix`: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-https-unixes.html +.. _`For HTTPS Connections on Windows`: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-https-windows.html \ No newline at end of file diff --git a/awscli/examples/codecommit/delete-file.rst b/awscli/examples/codecommit/delete-file.rst new file mode 100755 index 000000000000..5fdad2f7dd3d --- /dev/null +++ b/awscli/examples/codecommit/delete-file.rst @@ -0,0 +1,18 @@ +**To delete a file** + +The following ``delete-file`` example demonstrates how to delete a file named ``README.md`` from a branch named ``master`` with a most recent commit ID of ``c5709475EXAMPLE`` in a repository named ``MyDemoRepo``. :: + + aws codecommit delete-file --repository-name MyDemoRepo --branch-name master --file-path README.md --parent-commit-id c5709475EXAMPLE + +Output:: + + { + "blobId":"559b44fEXAMPLE", + "commitId":"353cf655EXAMPLE", + "filePath":"README.md", + "treeId":"6bc824cEXAMPLE" + } + +For more information, see `Edit or Delete a File in AWS CodeCommit`_ in the *AWS CodeCommit API Reference* guide. + +.. _`Edit or Delete a File in AWS CodeCommit`: https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-edit-file.html?shortFooter=true#how-to-edit-file-cli \ No newline at end of file diff --git a/awscli/examples/codecommit/get-file.rst b/awscli/examples/codecommit/get-file.rst new file mode 100755 index 000000000000..8fb5d47ebb3f --- /dev/null +++ b/awscli/examples/codecommit/get-file.rst @@ -0,0 +1,20 @@ +**To get the base-64 encoded contents of a file in an AWS CodeCommit repository** + +The following ``get-file`` example demonstrates how to get the base-64 encoded contents of a file named ``README.md`` from a branch named ``master`` in a repository named ``MyDemoRepo``. :: + + aws codecommit get-file --repository-name MyDemoRepo --commit-specifier master --file-path README.md + +Output:: + + { + "blobId":"559b44fEXAMPLE", + "commitId":"c5709475EXAMPLE", + "fileContent":"IyBQaHVzEXAMPLE", + "filePath":"README.md", + "fileMode":"NORMAL", + "fileSize":1563 + } + +For more information, see `GetFile`_ in the *AWS CodeCommit API Reference* guide. + +.. _`GetFile`: https://docs.aws.amazon.com/codecommit/latest/APIReference/API_GetFile.html diff --git a/awscli/examples/codecommit/get-folder.rst b/awscli/examples/codecommit/get-folder.rst new file mode 100755 index 000000000000..011992d12592 --- /dev/null +++ b/awscli/examples/codecommit/get-folder.rst @@ -0,0 +1,63 @@ +**To get the contents of a folder in an AWS CodeCommit repository** + +The following ``get-folder`` example demonstrates how to get the contents of a top-level folder from a repository named ``MyDemoRepo``. :: + + aws codecommit get-folder --repository-name MyDemoRepo --folder-path "" + +Output:: + + { + "commitId":"c5709475EXAMPLE", + "files":[ + { + "absolutePath":".gitignore", + "blobId":"74094e8bEXAMPLE", + "fileMode":"NORMAL", + "relativePath":".gitignore" + }, + { + "absolutePath":"Gemfile", + "blobId":"9ceb72f6EXAMPLE", + "fileMode":"NORMAL", + "relativePath":"Gemfile" + }, + { + "absolutePath":"Gemfile.lock", + "blobId":"795c4a2aEXAMPLE", + "fileMode":"NORMAL", + "relativePath":"Gemfile.lock" + }, + { + "absolutePath":"LICENSE.txt", + "blobId":"0c7932c8EXAMPLE", + "fileMode":"NORMAL", + "relativePath":"LICENSE.txt" + }, + { + "absolutePath":"README.md", + "blobId":"559b44feEXAMPLE", + "fileMode":"NORMAL", + "relativePath":"README.md" + } + ], + "folderPath":"", + "subFolders":[ + { + "absolutePath":"public", + "relativePath":"public", + "treeId":"d5e92ae3aEXAMPLE" + }, + { + "absolutePath":"tmp", + "relativePath":"tmp", + "treeId":"d564d0bcEXAMPLE" + } + ], + "subModules":[], + "symbolicLinks":[], + "treeId":"7b3c4dadEXAMPLE" + } + +For more information, see `GetFolder`_ in the *AWS CodeCommit API Reference* guide. + +.. _`GetFolder`: https://docs.aws.amazon.com/codecommit/latest/APIReference/API_GetFolder.html diff --git a/awscli/examples/deploy/add-tags-to-on-premises-instances.rst b/awscli/examples/deploy/add-tags-to-on-premises-instances.rst old mode 100644 new mode 100755 index 060b735c4952..747c79d8c25a --- a/awscli/examples/deploy/add-tags-to-on-premises-instances.rst +++ b/awscli/examples/deploy/add-tags-to-on-premises-instances.rst @@ -1,11 +1,9 @@ **To add tags to on-premises instances** -This example associates in AWS CodeDeploy the same on-premises instance tag to two on-premises instances. It does not register the on-premises instances with AWS CodeDeploy. +The follwoing ``add-tags-to-on-premises-instances`` example associates in AWS CodeDeploy the same on-premises instance tag to two on-premises instances. It does not register the on-premises instances with AWS CodeDeploy. :: -Command:: + aws deploy add-tags-to-on-premises-instances \ + --instance-names AssetTag12010298EX AssetTag23121309EX \ + --tags Key=Name,Value=CodeDeployDemo-OnPrem - aws deploy add-tags-to-on-premises-instances --instance-names AssetTag12010298EX AssetTag23121309EX --tags Key=Name,Value=CodeDeployDemo-OnPrem - -Output:: - - This command produces no output. \ No newline at end of file +This command produces no output. diff --git a/awscli/examples/deploy/batch-get-application-revisions.rst b/awscli/examples/deploy/batch-get-application-revisions.rst new file mode 100755 index 000000000000..5e0fdbdff2de --- /dev/null +++ b/awscli/examples/deploy/batch-get-application-revisions.rst @@ -0,0 +1,34 @@ +**To retrieve information about application revisions** + +The following ``batch-get-application-revisions`` example retrieves information about the specified revision stored in a GitHub repository. :: + + aws deploy batch-get-application-revisions \ + --application-name my-codedeploy-application \ + --revisions "[{\"gitHubLocation\": {\"commitId\": \"fa85936EXAMPLEa31736c051f10d77297EXAMPLE\",\"repository\": \"my-github-token/my-repository\"},\"revisionType\": \"GitHub\"}]" + +Output:: + + { + "revisions": [ + { + "genericRevisionInfo": { + "description": "Application revision registered by Deployment ID: d-A1B2C3111", + "lastUsedTime": 1556912355.884, + "registerTime": 1556912355.884, + "firstUsedTime": 1556912355.884, + "deploymentGroups": [] + }, + "revisionLocation": { + "revisionType": "GitHub", + "gitHubLocation": { + "commitId": "fa85936EXAMPLEa31736c051f10d77297EXAMPLE", + "repository": "my-github-token/my-repository" + } + } + } + ], + "applicationName": "my-codedeploy-application", + "errorMessage": "" + } + +For more information, see `BatchGetApplicationRevisions `_ in the *AWS CodeDeploy API Reference*. diff --git a/awscli/examples/deploy/batch-get-applications.rst b/awscli/examples/deploy/batch-get-applications.rst old mode 100644 new mode 100755 index 4076f60dadb5..5dc5b163a12f --- a/awscli/examples/deploy/batch-get-applications.rst +++ b/awscli/examples/deploy/batch-get-applications.rst @@ -1,26 +1,24 @@ **To get information about multiple applications** -This example displays information about multiple applications that are associated with the user's AWS account. +The following ``batch-get-applications`` example displays information about multiple applications that are associated with the user's AWS account. :: -Command:: - - aws deploy batch-get-applications --application-names WordPress_App MyOther_App + aws deploy batch-get-applications --application-names WordPress_App MyOther_App Output:: - { - "applicationsInfo": [ - { - "applicationName": "WordPress_App", - "applicationId": "d9dd6993-f171-44fa-a811-211e4EXAMPLE", - "createTime": 1407878168.078, - "linkedToGitHub": false - }, - { - "applicationName": "MyOther_App", - "applicationId": "8ca57519-31da-42b2-9194-8bb16EXAMPLE", - "createTime": 1407453571.63, - "linkedToGitHub": false - } - ] - } \ No newline at end of file + { + "applicationsInfo": [ + { + "applicationName": "WordPress_App", + "applicationId": "d9dd6993-f171-44fa-a811-211e4EXAMPLE", + "createTime": 1407878168.078, + "linkedToGitHub": false + }, + { + "applicationName": "MyOther_App", + "applicationId": "8ca57519-31da-42b2-9194-8bb16EXAMPLE", + "createTime": 1407453571.63, + "linkedToGitHub": false + } + ] + } diff --git a/awscli/examples/deploy/batch-get-deployment-groups.rst b/awscli/examples/deploy/batch-get-deployment-groups.rst new file mode 100755 index 000000000000..6b9d158151a8 --- /dev/null +++ b/awscli/examples/deploy/batch-get-deployment-groups.rst @@ -0,0 +1,86 @@ +**To retrieve information about one or more deployment groups** + +The following ``batch-get-deployment-groups`` example retrieves information about two of the deployment groups that are associated with the specified CodeDeploy application. :: + + aws deploy batch-get-deployment-groups \ + --application-name my-codedeploy-application \ + --deployment-group-names "[\"my-deployment-group-1\",\"my-deployment-group-2\"]" + +Output:: + + { + "deploymentGroupsInfo": [ + { + "deploymentStyle": { + "deploymentOption": "WITHOUT_TRAFFIC_CONTROL", + "deploymentType": "IN_PLACE" + }, + "autoRollbackConfiguration": { + "enabled": false + }, + "onPremisesTagSet": { + "onPremisesTagSetList": [] + }, + "serviceRoleArn": "arn:aws:iam::123456789012:role/CodeDeloyServiceRole", + "lastAttemptedDeployment": { + "endTime": 1556912366.415, + "status": "Failed", + "createTime": 1556912355.884, + "deploymentId": "d-A1B2C3111" + }, + "autoScalingGroups": [], + "deploymentGroupName": "my-deployment-group-1", + "ec2TagSet": { + "ec2TagSetList": [ + [ + { + "Type": "KEY_AND_VALUE", + "Value": "my-EC2-instance", + "Key": "Name" + } + ] + ] + }, + "deploymentGroupId": "a1b2c3d4-5678-90ab-cdef-11111example", + "triggerConfigurations": [], + "applicationName": "my-codedeploy-application", + "computePlatform": "Server", + "deploymentConfigName": "CodeDeployDefault.AllAtOnce" + }, + { + "deploymentStyle": { + "deploymentOption": "WITHOUT_TRAFFIC_CONTROL", + "deploymentType": "IN_PLACE" + }, + "autoRollbackConfiguration": { + "enabled": false + }, + "onPremisesTagSet": { + "onPremisesTagSetList": [] + }, + "serviceRoleArn": "arn:aws:iam::123456789012:role/CodeDeloyServiceRole", + "autoScalingGroups": [], + "deploymentGroupName": "my-deployment-group-2", + "ec2TagSet": { + "ec2TagSetList": [ + [ + { + "Type": "KEY_AND_VALUE", + "Value": "my-EC2-instance", + "Key": "Name" + } + ] + ] + }, + "deploymentGroupId": "a1b2c3d4-5678-90ab-cdef-22222example", + "triggerConfigurations": [], + "applicationName": "my-codedeploy-application", + "computePlatform": "Server", + "deploymentConfigName": "CodeDeployDefault.AllAtOnce" + } + ], + "errorMessage": "" + } + +For more information, see `BatchGetDeploymentGroups `_ in the *AWS CodeDeploy API Reference*. + \ No newline at end of file diff --git a/awscli/examples/deploy/batch-get-deployment-targets.rst b/awscli/examples/deploy/batch-get-deployment-targets.rst new file mode 100755 index 000000000000..c245e5c09ab2 --- /dev/null +++ b/awscli/examples/deploy/batch-get-deployment-targets.rst @@ -0,0 +1,64 @@ +**To retrieve the targets associated with a deployment** + +The following ``batch-get-deployment-targets`` example returns information about one of the targets associated with the specified deployment. :: + + aws deploy batch-get-deployment-targets \ + --deployment-id "d-1A2B3C4D5" \ + --target-ids "i-01a2b3c4d5e6f1111" + +Output:: + + { + "deploymentTargets": [ + { + "deploymentTargetType": "InstanceTarget", + "instanceTarget": { + "lifecycleEvents": [ + { + "startTime": 1556918592.162, + "lifecycleEventName": "ApplicationStop", + "status": "Succeeded", + "endTime": 1556918592.247, + "diagnostics": { + "scriptName": "", + "errorCode": "Success", + "logTail": "", + "message": "Succeeded" + } + }, + { + "startTime": 1556918593.193, + "lifecycleEventName": "DownloadBundle", + "status": "Succeeded", + "endTime": 1556918593.981, + "diagnostics": { + "scriptName": "", + "errorCode": "Success", + "logTail": "", + "message": "Succeeded" + } + }, + { + "startTime": 1556918594.805, + "lifecycleEventName": "BeforeInstall", + "status": "Succeeded", + "endTime": 1556918681.807, + "diagnostics": { + "scriptName": "", + "errorCode": "Success", + "logTail": "", + "message": "Succeeded" + } + } + ], + "targetArn": "arn:aws:ec2:us-west-2:123456789012:instance/i-01a2b3c4d5e6f1111", + "deploymentId": "d-1A2B3C4D5", + "lastUpdatedAt": 1556918687.504, + "targetId": "i-01a2b3c4d5e6f1111", + "status": "Succeeded" + } + } + ] + } + +For more information, see `BatchGetDeploymentTargets `_ in the *AWS CodeDeploy API Reference*. diff --git a/awscli/examples/deploy/batch-get-deployments.rst b/awscli/examples/deploy/batch-get-deployments.rst old mode 100644 new mode 100755 index 488faa4db98f..0e2d8fb810db --- a/awscli/examples/deploy/batch-get-deployments.rst +++ b/awscli/examples/deploy/batch-get-deployments.rst @@ -1,70 +1,68 @@ **To get information about multiple deployments** -This example displays information about multiple deployments that are associated with the user's AWS account. +The following ``batch-get-deployments`` example displays information about multiple deployments that are associated with the user's AWS account. :: -Command:: - - aws deploy batch-get-deployments --deployment-ids d-USUAELQEX d-QA4G4F9EX + aws deploy batch-get-deployments --deployment-ids d-A1B2C3111 d-A1B2C3222 Output:: - { - "deploymentsInfo": [ - { - "applicationName": "WordPress_App", - "status": "Failed", - "deploymentOverview": { - "Failed": 0, - "InProgress": 0, - "Skipped": 0, - "Succeeded": 1, - "Pending": 0 - }, - "deploymentConfigName": "CodeDeployDefault.OneAtATime", - "creator": "user", - "deploymentGroupName": "WordPress_DG", - "revision": { - "revisionType": "S3", - "s3Location": { - "bundleType": "zip", - "version": "uTecLusvCB_JqHFXtfUcyfV8bEXAMPLE", - "bucket": "CodeDeployDemoBucket", - "key": "WordPressApp.zip" - } - }, - "deploymentId": "d-QA4G4F9EX", - "createTime": 1408480721.9, - "completeTime": 1408480741.822 - }, - { - "applicationName": "MyOther_App", - "status": "Failed", - "deploymentOverview": { - "Failed": 1, - "InProgress": 0, - "Skipped": 0, - "Succeeded": 0, - "Pending": 0 - }, - "deploymentConfigName": "CodeDeployDefault.OneAtATime", - "creator": "user", - "errorInformation": { - "message": "Deployment failed: Constraint default violated: No hosts succeeded.", - "code": "HEALTH_CONSTRAINTS" - }, - "deploymentGroupName": "MyOther_DG", - "revision": { - "revisionType": "S3", - "s3Location": { - "bundleType": "zip", - "eTag": "\"dd56cfd59d434b8e768f9d77fEXAMPLE\"", - "bucket": "CodeDeployDemoBucket", - "key": "MyOtherApp.zip" - } - }, - "deploymentId": "d-USUAELQEX", - "createTime": 1409764576.589, - "completeTime": 1409764596.101 - } - ] - } + { + "deploymentsInfo": [ + { + "applicationName": "WordPress_App", + "status": "Failed", + "deploymentOverview": { + "Failed": 0, + "InProgress": 0, + "Skipped": 0, + "Succeeded": 1, + "Pending": 0 + }, + "deploymentConfigName": "CodeDeployDefault.OneAtATime", + "creator": "user", + "deploymentGroupName": "WordPress_DG", + "revision": { + "revisionType": "S3", + "s3Location": { + "bundleType": "zip", + "version": "uTecLusEXAMPLEFXtfUcyfV8bEXAMPLE", + "bucket": "CodeDeployDemoBucket", + "key": "WordPressApp.zip" + } + }, + "deploymentId": "d-A1B2C3111", + "createTime": 1408480721.9, + "completeTime": 1408480741.822 + }, + { + "applicationName": "MyOther_App", + "status": "Failed", + "deploymentOverview": { + "Failed": 1, + "InProgress": 0, + "Skipped": 0, + "Succeeded": 0, + "Pending": 0 + }, + "deploymentConfigName": "CodeDeployDefault.OneAtATime", + "creator": "user", + "errorInformation": { + "message": "Deployment failed: Constraint default violated: No hosts succeeded.", + "code": "HEALTH_CONSTRAINTS" + }, + "deploymentGroupName": "MyOther_DG", + "revision": { + "revisionType": "S3", + "s3Location": { + "bundleType": "zip", + "eTag": "\"dd56cfdEXAMPLE8e768f9d77fEXAMPLE\"", + "bucket": "CodeDeployDemoBucket", + "key": "MyOtherApp.zip" + } + }, + "deploymentId": "d-A1B2C3222", + "createTime": 1409764576.589, + "completeTime": 1409764596.101 + } + ] + } diff --git a/awscli/examples/deploy/batch-get-on-premises-instances.rst b/awscli/examples/deploy/batch-get-on-premises-instances.rst old mode 100644 new mode 100755 index 365588131543..75306215906e --- a/awscli/examples/deploy/batch-get-on-premises-instances.rst +++ b/awscli/examples/deploy/batch-get-on-premises-instances.rst @@ -1,38 +1,36 @@ **To get information about one or more on-premises instances** -This example gets information about two on-premises instances. +The follwoing ``batch-get-on-premises-instances`` example gets information about two on-premises instances. :: -Command:: - - aws deploy batch-get-on-premises-instances --instance-names AssetTag12010298EX AssetTag23121309EX + aws deploy batch-get-on-premises-instances --instance-names AssetTag12010298EX AssetTag23121309EX Output:: - { - "instanceInfos": [ - { - "iamUserArn": "arn:aws:iam::80398EXAMPLE:user/AWS/CodeDeploy/AssetTag12010298EX", - "tags": [ - { - "Value": "CodeDeployDemo-OnPrem", - "Key": "Name" - } - ], - "instanceName": "AssetTag12010298EX", - "registerTime": 1425579465.228, - "instanceArn": "arn:aws:codedeploy:us-west-2:80398EXAMPLE:instance/AssetTag12010298EX_4IwLNI2Alh" - }, - { - "iamUserArn": "arn:aws:iam::80398EXAMPLE:user/AWS/CodeDeploy/AssetTag23121309EX", - "tags": [ - { - "Value": "CodeDeployDemo-OnPrem", - "Key": "Name" - } - ], - "instanceName": "AssetTag23121309EX", - "registerTime": 1425595585.988, - "instanceArn": "arn:aws:codedeploy:us-west-2:80398EXAMPLE:instance/AssetTag23121309EX_PomUy64Was" - } - ] - } \ No newline at end of file + { + "instanceInfos": [ + { + "iamUserArn": "arn:aws:iam::123456789012:user/AWS/CodeDeploy/AssetTag12010298EX", + "tags": [ + { + "Value": "CodeDeployDemo-OnPrem", + "Key": "Name" + } + ], + "instanceName": "AssetTag12010298EX", + "registerTime": 1425579465.228, + "instanceArn": "arn:aws:codedeploy:us-west-2:123456789012:instance/AssetTag12010298EX_4IwLNI2Alh" + }, + { + "iamUserArn": "arn:aws:iam::123456789012:user/AWS/CodeDeploy/AssetTag23121309EX", + "tags": [ + { + "Value": "CodeDeployDemo-OnPrem", + "Key": "Name" + } + ], + "instanceName": "AssetTag23121309EX", + "registerTime": 1425595585.988, + "instanceArn": "arn:aws:codedeploy:us-west-2:80398EXAMPLE:instance/AssetTag23121309EX_PomUy64Was" + } + ] + } diff --git a/awscli/examples/deploy/continue-deployment.rst b/awscli/examples/deploy/continue-deployment.rst new file mode 100755 index 000000000000..b416be3536a6 --- /dev/null +++ b/awscli/examples/deploy/continue-deployment.rst @@ -0,0 +1,11 @@ +**To start rerouting traffic without waiting for a specified wait time to elapse.** + +The following ``continue-deployment`` example starts rerouting traffic from instances in the original environment that are ready to start shifting traffic to instances in the replacement environment. :: + + aws deploy continue-deployment \ + --deployment-d "d-A1B2C3111" \ + --deployment-wait-type "READY_WAIT" + +This command produces no output. + +For more information, see `ContinueDeployment `_ in the *AWS CodeDeploy API Reference*. diff --git a/awscli/examples/deploy/create-application.rst b/awscli/examples/deploy/create-application.rst old mode 100644 new mode 100755 index dcd35376d0d9..a8df33969d86 --- a/awscli/examples/deploy/create-application.rst +++ b/awscli/examples/deploy/create-application.rst @@ -1,13 +1,11 @@ **To create an application** -This example creates an application and associates it with the user's AWS account. +The following ``create-application`` example creates an application and associates it with the user's AWS account. :: -Command:: + aws deploy create-application --application-name MyOther_App - aws deploy create-application --application-name MyOther_App - Output:: - { - "applicationId": "cfd3e1f1-5744-4aee-9251-eaa25EXAMPLE" - } \ No newline at end of file + { + "applicationId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE" + } diff --git a/awscli/examples/deploy/create-deployment-config.rst b/awscli/examples/deploy/create-deployment-config.rst old mode 100644 new mode 100755 index 5650009fea7d..10315aae1789 --- a/awscli/examples/deploy/create-deployment-config.rst +++ b/awscli/examples/deploy/create-deployment-config.rst @@ -1,13 +1,13 @@ **To create a custom deployment configuration** -This example creates a custom deployment configuration and associates it with the user's AWS account. +The following ``create-deployment-config`` example creates a custom deployment configuration and associates it with the user's AWS account. :: -Command:: - - aws deploy create-deployment-config --deployment-config-name ThreeQuartersHealthy --minimum-healthy-hosts type=FLEET_PERCENT,value=75 + aws deploy create-deployment-config \ + --deployment-config-name ThreeQuartersHealthy \ + --minimum-healthy-hosts type=FLEET_PERCENT,value=75 Output:: - { - "deploymentConfigId": "bf6b390b-61d3-4f24-8911-a1664EXAMPLE" - } \ No newline at end of file + { + "deploymentConfigId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE" + } \ No newline at end of file diff --git a/awscli/examples/deploy/create-deployment-group.rst b/awscli/examples/deploy/create-deployment-group.rst old mode 100644 new mode 100755 index b90498443777..1a66b615c377 --- a/awscli/examples/deploy/create-deployment-group.rst +++ b/awscli/examples/deploy/create-deployment-group.rst @@ -1,13 +1,17 @@ **To create a deployment group** -This example creates a deployment group and associates it with the specified application and the user's AWS account. +The following ``create-deployment-group`` example creates a deployment group and associates it with the specified application and the user's AWS account. :: -Command:: - - aws deploy create-deployment-group --application-name WordPress_App --auto-scaling-groups CodeDeployDemo-ASG --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name WordPress_DG --ec2-tag-filters Key=Name,Value=CodeDeployDemo,Type=KEY_AND_VALUE --service-role-arn arn:aws:iam::80398EXAMPLE:role/CodeDeployDemoRole + aws deploy create-deployment-group \ + --application-name WordPress_App \ + --auto-scaling-groups CodeDeployDemo-ASG \ + --deployment-config-name CodeDeployDefault.OneAtATime \ + --deployment-group-name WordPress_DG \ + --ec2-tag-filters Key=Name,Value=CodeDeployDemo,Type=KEY_AND_VALUE \ + --service-role-arn arn:aws:iam::123456789012:role/CodeDeployDemoRole Output:: - { - "deploymentGroupId": "cdac3220-0e64-4d63-bb50-e68faEXAMPLE" - } \ No newline at end of file + { + "deploymentGroupId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE" + } diff --git a/awscli/examples/deploy/create-deployment.rst b/awscli/examples/deploy/create-deployment.rst old mode 100644 new mode 100755 index d4864856d14d..33244c7acf32 --- a/awscli/examples/deploy/create-deployment.rst +++ b/awscli/examples/deploy/create-deployment.rst @@ -1,13 +1,16 @@ **To create a deployment** -This example creates a deployment and associates it with the user's AWS account. +The following ``create-deployment`` example creates a deployment and associates it with the user's AWS account. :: -Command:: - - aws deploy create-deployment --application-name WordPress_App --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name WordPress_DG --description "My demo deployment" --s3-location bucket=CodeDeployDemoBucket,bundleType=zip,eTag=dd56cfd59d434b8e768f9d77fEXAMPLE,key=WordPressApp.zip + aws deploy create-deployment \ + --application-name WordPress_App \ + --deployment-config-name CodeDeployDefault.OneAtATime \ + --deployment-group-name WordPress_DG \ + --description "My demo deployment" \ + --s3-location bucket=CodeDeployDemoBucket,bundleType=zip,eTag=dd56cfdEXAMPLE8e768f9d77fEXAMPLE,key=WordPressApp.zip Output:: - { - "deploymentId": "d-N65YI7Gex" - } \ No newline at end of file + { + "deploymentId": "d-A1B2C3111" + } diff --git a/awscli/examples/deploy/delete-application.rst b/awscli/examples/deploy/delete-application.rst old mode 100644 new mode 100755 index ebf8d1f59fd8..65a0c488fb99 --- a/awscli/examples/deploy/delete-application.rst +++ b/awscli/examples/deploy/delete-application.rst @@ -1,11 +1,7 @@ **To delete an application** -This example deletes an application that is associated with the user's AWS account. +The following ``delete-application`` example deletes the specified application that is associated with the user's AWS account. :: -Command:: + aws deploy delete-application --application-name WordPress_App - aws deploy delete-application --application-name WordPress_App - -Output:: - - None. \ No newline at end of file +This command produces no output. \ No newline at end of file diff --git a/awscli/examples/deploy/delete-deployment-config.rst b/awscli/examples/deploy/delete-deployment-config.rst old mode 100644 new mode 100755 index 7ab89bacdd05..6b67bc877b77 --- a/awscli/examples/deploy/delete-deployment-config.rst +++ b/awscli/examples/deploy/delete-deployment-config.rst @@ -1,11 +1,7 @@ **To delete a deployment configuration** -This example deletes a custom deployment configuration that is associated with the user's AWS account. +The following ``delete-deployment-config`` example deletes a custom deployment configuration that is associated with the user's AWS account. :: -Command:: + aws deploy delete-deployment-config --deployment-config-name ThreeQuartersHealthy - aws deploy delete-deployment-config --deployment-config-name ThreeQuartersHealthy - -Output:: - - None. \ No newline at end of file +This command produces no output. diff --git a/awscli/examples/deploy/delete-deployment-group.rst b/awscli/examples/deploy/delete-deployment-group.rst old mode 100644 new mode 100755 index 7462684421de..065a945b4ba9 --- a/awscli/examples/deploy/delete-deployment-group.rst +++ b/awscli/examples/deploy/delete-deployment-group.rst @@ -1,13 +1,13 @@ **To delete a deployment group** -This example deletes a deployment group that is associated with the specified application. +The following ``delete-deployment-group`` example deletes a deployment group that is associated with the specified application. :: -Command:: - - aws deploy delete-deployment-group --application-name WordPress_App --deployment-group-name WordPress_DG + aws deploy delete-deployment-group \ + --application-name WordPress_App \ + --deployment-group-name WordPress_DG Output:: - { - "hooksNotCleanedUp": [] - } \ No newline at end of file + { + "hooksNotCleanedUp": [] + } diff --git a/awscli/examples/deploy/delete-git-hub-account-token.rst b/awscli/examples/deploy/delete-git-hub-account-token.rst new file mode 100755 index 000000000000..35a0ab0c7805 --- /dev/null +++ b/awscli/examples/deploy/delete-git-hub-account-token.rst @@ -0,0 +1,13 @@ +**To deletes a GitHub account connection** + +The following ``delete-git-hub-account-token`` example deletes the connection of the specified GitHub account. :: + + aws deploy delete-git-hub-account-token --token-name my-github-account + +Output:: + + { + "tokenName": "my-github-account" + } + +For more information, see `DeleteGitHubAccountToken `_ in the *AWS CodeDeploy API Reference*. diff --git a/awscli/examples/deploy/deregister-on-premises-instance.rst b/awscli/examples/deploy/deregister-on-premises-instance.rst old mode 100644 new mode 100755 index c2d6ac89f895..d94aa539bcdd --- a/awscli/examples/deploy/deregister-on-premises-instance.rst +++ b/awscli/examples/deploy/deregister-on-premises-instance.rst @@ -1,11 +1,7 @@ **To deregister an on-premises instance** -This example deregisters an on-premises instance with AWS CodeDeploy, but it does not delete the IAM user associated with the instance, nor does it disassociate in AWS CodeDeploy the on-premises instance tags from the instance. It also does not uninstall the AWS CodeDeploy Agent from the instance nor remove the on-premises configuration file from the instance. +The following ``deregister-on-premises-instance`` example deregisters an on-premises instance with AWS CodeDeploy, but it does not delete the IAM user associated with the instance, nor does it disassociate in AWS CodeDeploy the on-premises instance tags from the instance. It also does not uninstall the AWS CodeDeploy Agent from the instance nor remove the on-premises configuration file from the instance. :: -Command:: + aws deploy deregister-on-premises-instance --instance-name AssetTag12010298EX - aws deploy deregister-on-premises-instance --instance-name AssetTag12010298EX - -Output:: - - This command produces no output. \ No newline at end of file +This command produces no output. diff --git a/awscli/examples/deploy/deregister.rst b/awscli/examples/deploy/deregister.rst old mode 100644 new mode 100755 index 086372ba3f7c..91215aa1daa8 --- a/awscli/examples/deploy/deregister.rst +++ b/awscli/examples/deploy/deregister.rst @@ -1,17 +1,18 @@ **To deregister an on-premises instance** -This example deregisters an on-premises instance with AWS CodeDeploy. It does not delete the IAM user that is associated with the instance. It disassociates in AWS CodeDeploy the on-premises tags from the instance. It does not uninstall the AWS CodeDeploy Agent from the instance nor remove the on-premises configuration file from the instance. +The following ``deregister`` example deregisters an on-premises instance with AWS CodeDeploy. It does not delete the IAM user that is associated with the instance. It disassociates in AWS CodeDeploy the on-premises tags from the instance. It does not uninstall the AWS CodeDeploy Agent from the instance nor remove the on-premises configuration file from the instance. :: -Command:: - - aws deploy deregister --instance-name AssetTag12010298EX --no-delete-iam-user --region us-west-2 + aws deploy deregister \ + --instance-name AssetTag12010298EX \ + --no-delete-iam-user \ + --region us-west-2 Output:: - Retrieving on-premises instance information... DONE - IamUserArn: arn:aws:iam::80398EXAMPLE:user/AWS/CodeDeploy/AssetTag12010298EX - Tags: Key=Name,Value=CodeDeployDemo-OnPrem - Removing tags from the on-premises instance... DONE - Deregistering the on-premises instance... DONE - Run the following command on the on-premises instance to uninstall the codedeploy-agent: - aws deploy uninstall \ No newline at end of file + Retrieving on-premises instance information... DONE + IamUserArn: arn:aws:iam::80398EXAMPLE:user/AWS/CodeDeploy/AssetTag12010298EX + Tags: Key=Name,Value=CodeDeployDemo-OnPrem + Removing tags from the on-premises instance... DONE + Deregistering the on-premises instance... DONE + Run the following command on the on-premises instance to uninstall the codedeploy-agent: + aws deploy uninstall diff --git a/awscli/examples/deploy/get-application-revision.rst b/awscli/examples/deploy/get-application-revision.rst old mode 100644 new mode 100755 index fdb04f8af6a4..671e16ad926c --- a/awscli/examples/deploy/get-application-revision.rst +++ b/awscli/examples/deploy/get-application-revision.rst @@ -1,29 +1,29 @@ **To get information about an application revision** -This example displays information about an application revision that is associated with the specified application. +The following ``get-application-revision`` example displays information about an application revision that is associated with the specified application. :: -Command:: - - aws deploy get-application-revision --application-name WordPress_App --s3-location bucket=CodeDeployDemoBucket,bundleType=zip,eTag=dd56cfd59d434b8e768f9d77fEXAMPLE,key=WordPressApp.zip + aws deploy get-application-revision \ + --application-name WordPress_App \ + --s3-location bucket=CodeDeployDemoBucket,bundleType=zip,eTag=dd56cfdEXAMPLE8e768f9d77fEXAMPLE,key=WordPressApp.zip Output:: - { - "applicationName": "WordPress_App", - "revisionInfo": { - "description": "Application revision registered by Deployment ID: d-N65I7GEX", - "registerTime": 1411076520.009, - "deploymentGroups": "WordPress_DG", - "lastUsedTime": 1411076520.009, - "firstUsedTime": 1411076520.009 - }, - "revision": { - "revisionType": "S3", - "s3Location": { - "bundleType": "zip", - "eTag": "dd56cfd59d434b8e768f9d77fEXAMPLE", - "bucket": "CodeDeployDemoBucket", - "key": "WordPressApp.zip" - } - } - } \ No newline at end of file + { + "applicationName": "WordPress_App", + "revisionInfo": { + "description": "Application revision registered by Deployment ID: d-A1B2C3111", + "registerTime": 1411076520.009, + "deploymentGroups": "WordPress_DG", + "lastUsedTime": 1411076520.009, + "firstUsedTime": 1411076520.009 + }, + "revision": { + "revisionType": "S3", + "s3Location": { + "bundleType": "zip", + "eTag": "dd56cfdEXAMPLE8e768f9d77fEXAMPLE", + "bucket": "CodeDeployDemoBucket", + "key": "WordPressApp.zip" + } + } + } diff --git a/awscli/examples/deploy/get-application.rst b/awscli/examples/deploy/get-application.rst old mode 100644 new mode 100755 index ef4ad90ea9d1..d645219b9287 --- a/awscli/examples/deploy/get-application.rst +++ b/awscli/examples/deploy/get-application.rst @@ -1,18 +1,16 @@ **To get information about an application** -This example displays information about an application that is associated with the user's AWS account. +The following ``get-application`` example displays information about an application that is associated with the user's AWS account. :: -Command:: - - aws deploy get-application --application-name WordPress_App + aws deploy get-application --application-name WordPress_App Output:: - { - "application": { - "applicationName": "WordPress_App", - "applicationId": "d9dd6993-f171-44fa-a811-211e4EXAMPLE", - "createTime": 1407878168.078, - "linkedToGitHub": false - } - } \ No newline at end of file + { + "application": { + "applicationName": "WordPress_App", + "applicationId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", + "createTime": 1407878168.078, + "linkedToGitHub": false + } + } diff --git a/awscli/examples/deploy/get-deployment-config.rst b/awscli/examples/deploy/get-deployment-config.rst old mode 100644 new mode 100755 index d0ea96320f7d..0e0c82697940 --- a/awscli/examples/deploy/get-deployment-config.rst +++ b/awscli/examples/deploy/get-deployment-config.rst @@ -1,21 +1,19 @@ **To get information about a deployment configuration** -This example displays information about a deployment configuration that is associated with the user's AWS account. +The following ``get-deployment-config`` example displays information about a deployment configuration that is associated with the user's AWS account. :: -Command:: - - aws deploy get-deployment-config --deployment-config-name ThreeQuartersHealthy + aws deploy get-deployment-config --deployment-config-name ThreeQuartersHealthy Output:: - { - "deploymentConfigInfo": { - "deploymentConfigId": "bf6b390b-61d3-4f24-8911-a1664EXAMPLE", - "minimumHealthyHosts": { - "type": "FLEET_PERCENT", - "value": 75 - }, - "createTime": 1411081164.379, - "deploymentConfigName": "ThreeQuartersHealthy" - } - } \ No newline at end of file + { + "deploymentConfigInfo": { + "deploymentConfigId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", + "minimumHealthyHosts": { + "type": "FLEET_PERCENT", + "value": 75 + }, + "createTime": 1411081164.379, + "deploymentConfigName": "ThreeQuartersHealthy" + } + } diff --git a/awscli/examples/deploy/get-deployment-group.rst b/awscli/examples/deploy/get-deployment-group.rst old mode 100644 new mode 100755 index 75d84dea41e7..fbb7853df7bc --- a/awscli/examples/deploy/get-deployment-group.rst +++ b/awscli/examples/deploy/get-deployment-group.rst @@ -1,29 +1,29 @@ **To view information about a deployment group** -This example displays information about a deployment group that is associated with the specified application. +The following ``get-deployment-group`` example displays information about a deployment group that is associated with the specified application. :: -Command:: - - aws deploy get-deployment-group --application-name WordPress_App --deployment-group-name WordPress_DG + aws deploy get-deployment-group \ + --application-name WordPress_App \ + --deployment-group-name WordPress_DG Output:: - { - "deploymentGroupInfo": { - "applicationName": "WordPress_App", - "autoScalingGroups": [ - "CodeDeployDemo-ASG" - ], - "deploymentConfigName": "CodeDeployDefault.OneAtATime", - "ec2TagFilters": [ - { - "Type": "KEY_AND_VALUE", - "Value": "CodeDeployDemo", - "Key": "Name" - } - ], - "deploymentGroupId": "cdac3220-0e64-4d63-bb50-e68faEXAMPLE", - "serviceRoleArn": "arn:aws:iam::80398EXAMPLE:role/CodeDeployDemoRole", - "deploymentGroupName": "WordPress_DG" - } - } \ No newline at end of file + { + "deploymentGroupInfo": { + "applicationName": "WordPress_App", + "autoScalingGroups": [ + "CodeDeployDemo-ASG" + ], + "deploymentConfigName": "CodeDeployDefault.OneAtATime", + "ec2TagFilters": [ + { + "Type": "KEY_AND_VALUE", + "Value": "CodeDeployDemo", + "Key": "Name" + } + ], + "deploymentGroupId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", + "serviceRoleArn": "arn:aws:iam::123456789012:role/CodeDeployDemoRole", + "deploymentGroupName": "WordPress_DG" + } + } diff --git a/awscli/examples/deploy/get-deployment-instance.rst b/awscli/examples/deploy/get-deployment-instance.rst old mode 100644 new mode 100755 index a48cd8866b67..bdc91ffe0549 --- a/awscli/examples/deploy/get-deployment-instance.rst +++ b/awscli/examples/deploy/get-deployment-instance.rst @@ -1,60 +1,58 @@ **To get information about a deployment instance** -This example displays information about a deployment instance that is associated with the specified deployment. +The following ``get-deployment-instance`` example displays information about a deployment instance that is associated with the specified deployment. :: -Command:: - - aws deploy get-deployment-instance --deployment-id d-QA4G4F9EX --instance-id i-902e9fEX + aws deploy get-deployment-instance --deployment-id d-QA4G4F9EX --instance-id i-902e9fEX Output:: - { - "instanceSummary": { - "instanceId": "arn:aws:ec2:us-east-1:80398EXAMPLE:instance/i-902e9fEX", - "lifecycleEvents": [ - { - "status": "Succeeded", - "endTime": 1408480726.569, - "startTime": 1408480726.437, - "lifecycleEventName": "ApplicationStop" - }, - { - "status": "Succeeded", - "endTime": 1408480728.016, - "startTime": 1408480727.665, - "lifecycleEventName": "DownloadBundle" - }, - { - "status": "Succeeded", - "endTime": 1408480729.744, - "startTime": 1408480729.125, - "lifecycleEventName": "BeforeInstall" - }, - { - "status": "Succeeded", - "endTime": 1408480730.979, - "startTime": 1408480730.844, - "lifecycleEventName": "Install" - }, - { - "status": "Failed", - "endTime": 1408480732.603, - "startTime": 1408480732.1, - "lifecycleEventName": "AfterInstall" - }, - { - "status": "Skipped", - "endTime": 1408480732.606, - "lifecycleEventName": "ApplicationStart" - }, - { - "status": "Skipped", - "endTime": 1408480732.606, - "lifecycleEventName": "ValidateService" - } - ], - "deploymentId": "d-QA4G4F9EX", - "lastUpdatedAt": 1408480733.152, - "status": "Failed" - } - } \ No newline at end of file + { + "instanceSummary": { + "instanceId": "arn:aws:ec2:us-east-1:80398EXAMPLE:instance/i-902e9fEX", + "lifecycleEvents": [ + { + "status": "Succeeded", + "endTime": 1408480726.569, + "startTime": 1408480726.437, + "lifecycleEventName": "ApplicationStop" + }, + { + "status": "Succeeded", + "endTime": 1408480728.016, + "startTime": 1408480727.665, + "lifecycleEventName": "DownloadBundle" + }, + { + "status": "Succeeded", + "endTime": 1408480729.744, + "startTime": 1408480729.125, + "lifecycleEventName": "BeforeInstall" + }, + { + "status": "Succeeded", + "endTime": 1408480730.979, + "startTime": 1408480730.844, + "lifecycleEventName": "Install" + }, + { + "status": "Failed", + "endTime": 1408480732.603, + "startTime": 1408480732.1, + "lifecycleEventName": "AfterInstall" + }, + { + "status": "Skipped", + "endTime": 1408480732.606, + "lifecycleEventName": "ApplicationStart" + }, + { + "status": "Skipped", + "endTime": 1408480732.606, + "lifecycleEventName": "ValidateService" + } + ], + "deploymentId": "d-QA4G4F9EX", + "lastUpdatedAt": 1408480733.152, + "status": "Failed" + } + } diff --git a/awscli/examples/deploy/get-deployment-target.rst b/awscli/examples/deploy/get-deployment-target.rst new file mode 100755 index 000000000000..81258b0f92ca --- /dev/null +++ b/awscli/examples/deploy/get-deployment-target.rst @@ -0,0 +1,110 @@ +**To return information about a deployment target** + +The following ``get-deployment-target`` example returns information about a deployment target that is associated with the specified deployment. :: + + aws deploy get-deployment-target \ + --deployment-id "d-A1B2C3111" \ + --target-id "i-a1b2c3d4e5f611111" + +Output:: + + { + "deploymentTarget": { + "deploymentTargetType": "InstanceTarget", + "instanceTarget": { + "lastUpdatedAt": 1556918687.504, + "targetId": "i-a1b2c3d4e5f611111", + "targetArn": "arn:aws:ec2:us-west-2:123456789012:instance/i-a1b2c3d4e5f611111", + "status": "Succeeded", + "lifecycleEvents": [ + { + "status": "Succeeded", + "diagnostics": { + "errorCode": "Success", + "message": "Succeeded", + "logTail": "", + "scriptName": "" + }, + "lifecycleEventName": "ApplicationStop", + "startTime": 1556918592.162, + "endTime": 1556918592.247 + }, + { + "status": "Succeeded", + "diagnostics": { + "errorCode": "Success", + "message": "Succeeded", + "logTail": "", + "scriptName": "" + }, + "lifecycleEventName": "DownloadBundle", + "startTime": 1556918593.193, + "endTime": 1556918593.981 + }, + { + "status": "Succeeded", + "diagnostics": { + "errorCode": "Success", + "message": "Succeeded", + "logTail": "", + "scriptName": "" + }, + "lifecycleEventName": "BeforeInstall", + "startTime": 1556918594.805, + "endTime": 1556918681.807 + }, + { + "status": "Succeeded", + "diagnostics": { + "errorCode": "Success", + "message": "Succeeded", + "logTail": "", + "scriptName": "" + }, + "lifecycleEventName": "Install", + "startTime": 1556918682.696, + "endTime": 1556918683.005 + }, + { + "status": "Succeeded", + "diagnostics": { + "errorCode": "Success", + "message": "Succeeded", + "logTail": "", + "scriptName": "" + }, + "lifecycleEventName": "AfterInstall", + "startTime": 1556918684.135, + "endTime": 1556918684.216 + }, + { + "status": "Succeeded", + "diagnostics": { + "errorCode": "Success", + "message": "Succeeded", + "logTail": "", + "scriptName": "" + }, + "lifecycleEventName": "ApplicationStart", + "startTime": 1556918685.211, + "endTime": 1556918685.295 + }, + { + "status": "Succeeded", + "diagnostics": { + "errorCode": "Success", + "message": "Succeeded", + "logTail": "", + "scriptName": "" + }, + "lifecycleEventName": "ValidateService", + "startTime": 1556918686.65, + "endTime": 1556918686.747 + } + ], + "deploymentId": "d-A1B2C3111" + } + } + } + +For more information, see `GetDeploymentTarget `_ in the *AWS CodeDeploy API Reference*. diff --git a/awscli/examples/deploy/get-deployment.rst b/awscli/examples/deploy/get-deployment.rst old mode 100644 new mode 100755 index 3a512d13c89d..8bdc8255155b --- a/awscli/examples/deploy/get-deployment.rst +++ b/awscli/examples/deploy/get-deployment.rst @@ -1,40 +1,38 @@ **To get information about a deployment** -This example displays information about a deployment that is associated with the user's AWS account. +The following ``get-deployment`` example displays information about a deployment that is associated with the user's AWS account. :: -Command:: - - aws deploy get-deployment --deployment-id d-USUAELQEX + aws deploy get-deployment --deployment-id d-A1B2C3123 Output:: - { - "deploymentInfo": { - "applicationName": "WordPress_App", - "status": "Succeeded", - "deploymentOverview": { - "Failed": 0, - "InProgress": 0, - "Skipped": 0, - "Succeeded": 1, - "Pending": 0 - }, - "deploymentConfigName": "CodeDeployDefault.OneAtATime", - "creator": "user", - "description": "My WordPress app deployment", - "revision": { - "revisionType": "S3", - "s3Location": { - "bundleType": "zip", - "eTag": "\"dd56cfd59d434b8e768f9d77fEXAMPLE\"", - "bucket": "CodeDeployDemoBucket", - "key": "WordPressApp.zip" - } - }, - "deploymentId": "d-USUAELQEX", - "deploymentGroupName": "WordPress_DG", - "createTime": 1409764576.589, - "completeTime": 1409764596.101, - "ignoreApplicationStopFailures": false - } - } \ No newline at end of file + { + "deploymentInfo": { + "applicationName": "WordPress_App", + "status": "Succeeded", + "deploymentOverview": { + "Failed": 0, + "InProgress": 0, + "Skipped": 0, + "Succeeded": 1, + "Pending": 0 + }, + "deploymentConfigName": "CodeDeployDefault.OneAtATime", + "creator": "user", + "description": "My WordPress app deployment", + "revision": { + "revisionType": "S3", + "s3Location": { + "bundleType": "zip", + "eTag": "\"dd56cfdEXAMPLE8e768f9d77fEXAMPLE\"", + "bucket": "CodeDeployDemoBucket", + "key": "WordPressApp.zip" + } + }, + "deploymentId": "d-A1B2C3123", + "deploymentGroupName": "WordPress_DG", + "createTime": 1409764576.589, + "completeTime": 1409764596.101, + "ignoreApplicationStopFailures": false + } + } diff --git a/awscli/examples/deploy/get-on-premises-instance.rst b/awscli/examples/deploy/get-on-premises-instance.rst old mode 100644 new mode 100755 index 2461dc92860d..6b8520a8ca7c --- a/awscli/examples/deploy/get-on-premises-instance.rst +++ b/awscli/examples/deploy/get-on-premises-instance.rst @@ -1,24 +1,22 @@ **To get information about an on-premises instance** -This example gets information about an on-premises instance. +The following ``get-on-premises-instance`` example retrieves information about the specified on-premises instance. :: -Command:: - - aws deploy get-on-premises-instance --instance-name AssetTag12010298EX + aws deploy get-on-premises-instance --instance-name AssetTag12010298EX Output:: - { - "instanceInfo": { - "iamUserArn": "arn:aws:iam::80398EXAMPLE:user/AWS/CodeDeploy/AssetTag12010298EX", - "tags": [ - { - "Value": "CodeDeployDemo-OnPrem", - "Key": "Name" - } - ], - "instanceName": "AssetTag12010298EX", - "registerTime": 1425579465.228, - "instanceArn": "arn:aws:codedeploy:us-east-1:80398EXAMPLE:instance/AssetTag12010298EX_4IwLNI2Alh" - } - } \ No newline at end of file + { + "instanceInfo": { + "iamUserArn": "arn:aws:iam::123456789012:user/AWS/CodeDeploy/AssetTag12010298EX", + "tags": [ + { + "Value": "CodeDeployDemo-OnPrem", + "Key": "Name" + } + ], + "instanceName": "AssetTag12010298EX", + "registerTime": 1425579465.228, + "instanceArn": "arn:aws:codedeploy:us-east-1:123456789012:instance/AssetTag12010298EX_4IwLNI2Alh" + } + } \ No newline at end of file diff --git a/awscli/examples/deploy/install.rst b/awscli/examples/deploy/install.rst old mode 100644 new mode 100755 index 9a015e0f369a..8696e5d262cb --- a/awscli/examples/deploy/install.rst +++ b/awscli/examples/deploy/install.rst @@ -1,13 +1,14 @@ **To install an on-premises instance** -This example copies the on-premises configuration file from the specified location on the instance to the location on the instance that the AWS CodeDeploy Agent expects to find it. It also installs the AWS CodeDeploy Agent on the instance. It does not create any IAM user, nor register the on-premises instance with AWS CodeDeploy, nor associate any on-premises instance tags in AWS CodeDeploy for the instance. - -Command:: - - aws deploy install --override-config --config-file C:\temp\codedeploy.onpremises.yml --region us-west-2 --agent-installer s3://aws-codedeploy-us-west-2/latest/codedeploy-agent.msi +The following ``install`` example copies the on-premises configuration file from the specified location on the instance to the location on the instance that the AWS CodeDeploy Agent expects to find it. It also installs the AWS CodeDeploy Agent on the instance. It does not create any IAM user, nor register the on-premises instance with AWS CodeDeploy, nor associate any on-premises instance tags in AWS CodeDeploy for the instance. :: + aws deploy install \ + --override-config \ + --config-file C:\temp\codedeploy.onpremises.yml \ + --region us-west-2 \ + --agent-installer s3://aws-codedeploy-us-west-2/latest/codedeploy-agent.msi Output:: - Creating the on-premises instance configuration file... DONE - Installing the AWS CodeDeploy Agent... DONE \ No newline at end of file + Creating the on-premises instance configuration file... DONE + Installing the AWS CodeDeploy Agent... DONE diff --git a/awscli/examples/deploy/list-application-revisions.rst b/awscli/examples/deploy/list-application-revisions.rst old mode 100644 new mode 100755 index 81068a172280..fc199fd1a887 --- a/awscli/examples/deploy/list-application-revisions.rst +++ b/awscli/examples/deploy/list-application-revisions.rst @@ -1,32 +1,36 @@ **To get information about application revisions** -This example displays information about all application revisions that are associated with the specified application. +The following ``list-application-revisions`` example displays information about all application revisions that are associated with the specified application. :: -Command:: - - aws deploy list-application-revisions --application-name WordPress_App --s-3-bucket CodeDeployDemoBucket --deployed exclude --s-3-key-prefix WordPress_ --sort-by lastUsedTime --sort-order descending + aws deploy list-application-revisions \ + --application-name WordPress_App \ + --s-3-bucket CodeDeployDemoBucket \ + --deployed exclude \ + --s-3-key-prefix WordPress_ \ + --sort-by lastUsedTime \ + --sort-order descending Output:: - { - "revisions": [ - { - "revisionType": "S3", - "s3Location": { - "version": "uTecLusvCB_JqHFXtfUcyfV8bEXAMPLE", - "bucket": "CodeDeployDemoBucket", - "key": "WordPress_App.zip", - "bundleType": "zip" - } - }, - { - "revisionType": "S3", - "s3Location": { - "version": "tMk.UxgDpMEVb7V187ZM6wVAWEXAMPLE", - "bucket": "CodeDeployDemoBucket", - "key": "WordPress_App_2-0.zip", - "bundleType": "zip" - } - } - ] - } + { + "revisions": [ + { + "revisionType": "S3", + "s3Location": { + "version": "uTecLusvCB_JqHFXtfUcyfV8bEXAMPLE", + "bucket": "CodeDeployDemoBucket", + "key": "WordPress_App.zip", + "bundleType": "zip" + } + }, + { + "revisionType": "S3", + "s3Location": { + "version": "tMk.UxgDpMEVb7V187ZM6wVAWEXAMPLE", + "bucket": "CodeDeployDemoBucket", + "key": "WordPress_App_2-0.zip", + "bundleType": "zip" + } + } + ] + } diff --git a/awscli/examples/deploy/list-applications.rst b/awscli/examples/deploy/list-applications.rst old mode 100644 new mode 100755 index cf8c7a7c5068..fb169bdc5ef0 --- a/awscli/examples/deploy/list-applications.rst +++ b/awscli/examples/deploy/list-applications.rst @@ -1,16 +1,14 @@ **To get information about applications** -This example displays information about all applications that are associated with the user's AWS account. +The following ``list-applications`` example displays information about all applications that are associated with the user's AWS account. :: -Command:: - - aws deploy list-applications + aws deploy list-applications Output:: - { - "applications": [ - "WordPress_App", - "MyOther_App" - ] - } \ No newline at end of file + { + "applications": [ + "WordPress_App", + "MyOther_App" + ] + } diff --git a/awscli/examples/deploy/list-deployment-configs.rst b/awscli/examples/deploy/list-deployment-configs.rst old mode 100644 new mode 100755 index f7e99ab37586..0fbb6cbddbf4 --- a/awscli/examples/deploy/list-deployment-configs.rst +++ b/awscli/examples/deploy/list-deployment-configs.rst @@ -1,18 +1,16 @@ **To get information about deployment configurations** -This example displays information about all deployment configurations that are associated with the user's AWS account. +The following ``list-deployment-configs`` example displays information about all deployment configurations that are associated with the user's AWS account. :: -Command:: - - aws deploy list-deployment-configs + aws deploy list-deployment-configs Output:: - { - "deploymentConfigsList": [ - "ThreeQuartersHealthy", - "CodeDeployDefault.AllAtOnce", - "CodeDeployDefault.HalfAtATime", - "CodeDeployDefault.OneAtATime" - ] - } \ No newline at end of file + { + "deploymentConfigsList": [ + "ThreeQuartersHealthy", + "CodeDeployDefault.AllAtOnce", + "CodeDeployDefault.HalfAtATime", + "CodeDeployDefault.OneAtATime" + ] + } diff --git a/awscli/examples/deploy/list-deployment-groups.rst b/awscli/examples/deploy/list-deployment-groups.rst old mode 100644 new mode 100755 index de612e0be0d9..9b19b319052d --- a/awscli/examples/deploy/list-deployment-groups.rst +++ b/awscli/examples/deploy/list-deployment-groups.rst @@ -1,17 +1,15 @@ **To get information about deployment groups** -This example displays information about all deployment groups that are associated with the specified application. +The following ``list-deployment-groups`` example displays information about all deployment groups that are associated with the specified application. :: -Command:: - - aws deploy list-deployment-groups --application-name WordPress_App + aws deploy list-deployment-groups --application-name WordPress_App Output:: - { - "applicationName": "WordPress_App", - "deploymentGroups": [ - "WordPress_DG", - "WordPress_Beta_DG" - ] - } \ No newline at end of file + { + "applicationName": "WordPress_App", + "deploymentGroups": [ + "WordPress_DG", + "WordPress_Beta_DG" + ] + } diff --git a/awscli/examples/deploy/list-deployment-instances.rst b/awscli/examples/deploy/list-deployment-instances.rst old mode 100644 new mode 100755 index a576abe994ec..f78e457fa5ee --- a/awscli/examples/deploy/list-deployment-instances.rst +++ b/awscli/examples/deploy/list-deployment-instances.rst @@ -1,16 +1,16 @@ **To get information about deployment instances** -This example displays information about all deployment instances that are associated with the specified deployment. +The following ``list-deployment-instances`` example displays information about all deployment instances that are associated with the specified deployment. :: -Command:: - - aws deploy list-deployment-instances --deployment-id d-9DI6I4EX --instance-status-filter Succeeded + aws deploy list-deployment-instances \ + --deployment-id d-A1B2C3111 \ + --instance-status-filter Succeeded Output:: - { - "instancesList": [ - "i-8c4490EX", - "i-7d5389EX" - ] - } \ No newline at end of file + { + "instancesList": [ + "i-EXAMPLE11", + "i-EXAMPLE22" + ] + } diff --git a/awscli/examples/deploy/list-deployment-targets.rst b/awscli/examples/deploy/list-deployment-targets.rst new file mode 100755 index 000000000000..ee26a7eb26cd --- /dev/null +++ b/awscli/examples/deploy/list-deployment-targets.rst @@ -0,0 +1,17 @@ +**To retrieve a list of target IDs that are associated with a deployment** + +The following ``list-deployment-targets`` example retrieves a list of target IDs associated with deployments that have a status of "Failed" or "InProgress." :: + + aws deploy list-deployment-targets \ + --deployment-id "d-A1B2C3111" \ + --target-filters "{\"TargetStatus\":[\"Failed\",\"InProgress\"]}" + +Output:: + + { + "targetIds": [ + "i-0f1558aaf90e5f1f9" + ] + } + +For more information, see `ListDeploymentTargets `_ in the *AWS CodeDeploy API Reference*. diff --git a/awscli/examples/deploy/list-deployments.rst b/awscli/examples/deploy/list-deployments.rst old mode 100644 new mode 100755 index 54077fac60a6..7cf538a1a947 --- a/awscli/examples/deploy/list-deployments.rst +++ b/awscli/examples/deploy/list-deployments.rst @@ -1,17 +1,19 @@ **To get information about deployments** -This example displays information about all deployments that are associated with the specified application and deployment group. +The follwoing ``list-deployments`` example displays information about all deployments that are associated with the specified application and deployment group. :: -Command:: - - aws deploy list-deployments --application-name WordPress_App --create-time-range start=2014-08-19T00:00:00,end=2014-08-20T00:00:00 --deployment-group-name WordPress_DG --include-only-statuses Failed + aws deploy list-deployments \ + --application-name WordPress_App \ + --create-time-range start=2014-08-19T00:00:00,end=2014-08-20T00:00:00 \ + --deployment-group-name WordPress_DG \ + --include-only-statuses Failed Output:: - { - "deployments": [ - "d-QA4G4F9EX", - "d-1MVNYOEEX", - "d-WEWRE8BEX" - ] - } \ No newline at end of file + { + "deployments": [ + "d-EXAMPLE11", + "d-EXAMPLE22", + "d-EXAMPLE33" + ] + } \ No newline at end of file diff --git a/awscli/examples/deploy/list-git-hub-account-token-names.rst b/awscli/examples/deploy/list-git-hub-account-token-names.rst new file mode 100755 index 000000000000..dc7aa2d0a4eb --- /dev/null +++ b/awscli/examples/deploy/list-git-hub-account-token-names.rst @@ -0,0 +1,17 @@ +**To lists the names of stored connections to GitHub accounts** + +The following ``list-git-hub-account-token-names`` example lists the names of the stored connections to GitHub accounts for the current AWS user. :: + + aws deploy list-git-hub-account-token-names + +Output:: + + { + "tokenNameList": [ + "my-first-token", + "my-second-token", + "my-third-token" + ] + } + +For more information, see `ListGitHubAccountTokenNames `_ in the *AWS CodeDeploy API Reference*. diff --git a/awscli/examples/deploy/list-on-premises-instances.rst b/awscli/examples/deploy/list-on-premises-instances.rst old mode 100644 new mode 100755 index 5c2a371cc113..3b5a45488034 --- a/awscli/examples/deploy/list-on-premises-instances.rst +++ b/awscli/examples/deploy/list-on-premises-instances.rst @@ -1,15 +1,15 @@ **To get information about one or more on-premises instances** -This example gets a list of available on-premises instance names for instances that are registered in AWS CodeDeploy and also have the specified on-premises instance tag associated in AWS CodeDeploy with the instance. +The following ``list-on-premises-instances`` example retrieves a list of available on-premises instance names for instances that are registered in AWS CodeDeploy and also have the specified on-premises instance tag associated in AWS CodeDeploy with the instance. :: -Command:: - - aws deploy list-on-premises-instances --registration-status Registered --tag-filters Key=Name,Value=CodeDeployDemo-OnPrem,Type=KEY_AND_VALUE + aws deploy list-on-premises-instances \ + --registration-status Registered \ + --tag-filters Key=Name,Value=CodeDeployDemo-OnPrem,Type=KEY_AND_VALUE Output:: - { - "instanceNames": [ - "AssetTag12010298EX" - ] - } \ No newline at end of file + { + "instanceNames": [ + "AssetTag12010298EX" + ] + } diff --git a/awscli/examples/deploy/push.rst b/awscli/examples/deploy/push.rst old mode 100644 new mode 100755 index 01409408cf0b..ea30dc58e71a --- a/awscli/examples/deploy/push.rst +++ b/awscli/examples/deploy/push.rst @@ -1,14 +1,15 @@ **To bundle and deploy an AWS CodeDeploy compatible application revision to Amazon S3** -This example bundles and deploys an application revision to Amazon S3 and then associates the application revision with the specified application. +The following ``push`` example bundles and deploys an application revision to Amazon S3 and then associates the application revision with the specified application. :: -Use the output of the push command to create a deployment that uses the uploaded application revision. + aws deploy push \ + --application-name WordPress_App \ + --description "This is my deployment" \ + --ignore-hidden-files \ + --s3-location s3://CodeDeployDemoBucket/WordPressApp.zip \ + --source /tmp/MyLocalDeploymentFolder/ -Command:: +The output describes how to use the ``create-deployment`` command to create a deployment that uses the uploaded application revision. :: - aws deploy push --application-name WordPress_App --description "This is my deployment" --ignore-hidden-files --s3-location s3://CodeDeployDemoBucket/WordPressApp.zip --source /tmp/MyLocalDeploymentFolder/ - -Output:: - - To deploy with this revision, run: - aws deploy create-deployment --application-name WordPress_App --deployment-config-name --deployment-group-name --s3-location bucket=CodeDeployDemoBucket,key=WordPressApp.zip,bundleType=zip,eTag="cecc9b8a08eac650a6e71fdb88EXAMPLE",version=LFsJAUd_2J4VWXfvKtvi79L8EXAMPLE \ No newline at end of file + To deploy with this revision, run: + aws deploy create-deployment --application-name WordPress_App --deployment-config-name --deployment-group-name --s3-location bucket=CodeDeployDemoBucket,key=WordPressApp.zip,bundleType=zip,eTag="cecc9b8EXAMPLE50a6e71fdb88EXAMPLE",version=LFsJAUdEXAMPLEfvKtvi79L8EXAMPLE \ No newline at end of file diff --git a/awscli/examples/deploy/register-application-revision.rst b/awscli/examples/deploy/register-application-revision.rst old mode 100644 new mode 100755 index 2fb79beece93..49a03130afe3 --- a/awscli/examples/deploy/register-application-revision.rst +++ b/awscli/examples/deploy/register-application-revision.rst @@ -1,11 +1,10 @@ **To register information about an already-uploaded application revision** -This example registers information about an already-uploaded application revision in Amazon S3 with AWS CodeDeploy. +The following ``register-application-revision`` example registers information about an already-uploaded application revision stored in Amazon S3 with AWS CodeDeploy. :: -Command:: + aws deploy register-application-revision \ + --application-name WordPress_App \ + --description "Revised WordPress application" \ + --s3-location bucket=CodeDeployDemoBucket,key=RevisedWordPressApp.zip,bundleType=zip,eTag=cecc9b8a08eac650a6e71fdb88EXAMPLE - aws deploy register-application-revision --application-name WordPress_App --description "Revised WordPress application" --s3-location bucket=CodeDeployDemoBucket,key=RevisedWordPressApp.zip,bundleType=zip,eTag=cecc9b8a08eac650a6e71fdb88EXAMPLE - -Output:: - - None. \ No newline at end of file +This command produces no output. diff --git a/awscli/examples/deploy/register-on-premises-instance.rst b/awscli/examples/deploy/register-on-premises-instance.rst old mode 100644 new mode 100755 index b22a34981911..a2e36cfa3373 --- a/awscli/examples/deploy/register-on-premises-instance.rst +++ b/awscli/examples/deploy/register-on-premises-instance.rst @@ -1,11 +1,9 @@ **To register an on-premises instance** -This example registers an on-premises instance with AWS CodeDeploy. It does not create the specified IAM user, nor does it associate in AWS CodeDeploy any on-premises instances tags with the registered instance. +The following ``register-on-premises-instance`` example registers an on-premises instance with AWS CodeDeploy. It does not create the specified IAM user, nor does it associate in AWS CodeDeploy any on-premises instances tags with the registered instance. :: -Command:: + aws deploy register-on-premises-instance \ + --instance-name AssetTag12010298EX \ + --iam-user-arn arn:aws:iam::80398EXAMPLE:user/CodeDeployDemoUser-OnPrem - aws deploy register-on-premises-instance --instance-name AssetTag12010298EX --iam-user-arn arn:aws:iam::80398EXAMPLE:user/CodeDeployDemoUser-OnPrem - -Output:: - - This command produces no output. \ No newline at end of file +This command produces no output. diff --git a/awscli/examples/deploy/register.rst b/awscli/examples/deploy/register.rst old mode 100644 new mode 100755 index 5982ca0f8158..5bea00807296 --- a/awscli/examples/deploy/register.rst +++ b/awscli/examples/deploy/register.rst @@ -1,14 +1,16 @@ **To register an on-premises instance** -This example registers an on-premises instance with AWS CodeDeploy, associates in AWS CodeDeploy the specified on-premises instance tag with the registered instance, and creates an on-premises configuration file that can be copied to the instance. It does not create the IAM user, nor does it install the AWS CodeDeploy Agent on the instance. +The following ``register`` example registers an on-premises instance with AWS CodeDeploy, associates in AWS CodeDeploy the specified on-premises instance tag with the registered instance, and creates an on-premises configuration file that can be copied to the instance. It does not create the IAM user, nor does it install the AWS CodeDeploy Agent on the instance. :: -Command:: - - aws deploy register --instance-name AssetTag12010298EX --iam-user-arn arn:aws:iam::80398EXAMPLE:user/CodeDeployUser-OnPrem --tags Key=Name,Value=CodeDeployDemo-OnPrem --region us-west-2 + aws deploy register \ + --instance-name AssetTag12010298EX \ + --iam-user-arn arn:aws:iam::80398EXAMPLE:user/CodeDeployUser-OnPrem \ + --tags Key=Name,Value=CodeDeployDemo-OnPrem \ + --region us-west-2 Output:: - Registering the on-premises instance... DONE - Adding tags to the on-premises instance... DONE - Copy the on-premises configuration file named codedeploy.onpremises.yml to the on-premises instance, and run the following command on the on-premises instance to install and configure the AWS CodeDeploy Agent: - aws deploy install --config-file codedeploy.onpremises.yml \ No newline at end of file + Registering the on-premises instance... DONE + Adding tags to the on-premises instance... DONE + Copy the on-premises configuration file named codedeploy.onpremises.yml to the on-premises instance, and run the following command on the on-premises instance to install and configure the AWS CodeDeploy Agent: + aws deploy install --config-file codedeploy.onpremises.yml diff --git a/awscli/examples/deploy/remove-tags-from-on-premises-instances.rst b/awscli/examples/deploy/remove-tags-from-on-premises-instances.rst old mode 100644 new mode 100755 index 75cdf2062ec3..a7ab76590cb3 --- a/awscli/examples/deploy/remove-tags-from-on-premises-instances.rst +++ b/awscli/examples/deploy/remove-tags-from-on-premises-instances.rst @@ -1,11 +1,9 @@ **To remove tags from one or more on-premises instances** -This example disassociates the same on-premises tag in AWS CodeDeploy from the two specified on-premises instances. It does not deregister the on-premises instances in AWS CodeDeploy, nor uninstall the AWS CodeDeploy Agent from the instance, nor remove the on-premises configuration file from the instances, nor delete the IAM users that are associated with the instances. +The following ``remove-tags-from-on-premises-instances`` example disassociates the specified on-premises tags in AWS CodeDeploy from on-premises instances. It does not deregister the on-premises instances in AWS CodeDeploy, nor uninstall the AWS CodeDeploy Agent from the instance, nor remove the on-premises configuration file from the instances, nor delete the IAM users that are associated with the instances. :: -Command:: + aws deploy remove-tags-from-on-premises-instances \ + --instance-names AssetTag12010298EX AssetTag23121309EX \ + --tags Key=Name,Value=CodeDeployDemo-OnPrem - aws deploy remove-tags-from-on-premises-instances --instance-names AssetTag12010298EX AssetTag23121309EX --tags Key=Name,Value=CodeDeployDemo-OnPrem - -Output:: - - This command produces no output. \ No newline at end of file +This command produces no output. diff --git a/awscli/examples/deploy/stop-deployment.rst b/awscli/examples/deploy/stop-deployment.rst old mode 100644 new mode 100755 index 1079e618ce8a..ad13a7fcb099 --- a/awscli/examples/deploy/stop-deployment.rst +++ b/awscli/examples/deploy/stop-deployment.rst @@ -1,14 +1,12 @@ **To attempt to stop a deployment** -This example attempts to stop an in-progress deployment that is associated with the user's AWS account. +The following ``stop-deployment`` example attempts to stop an in-progress deployment that is associated with the user's AWS account. -Command:: - - aws deploy stop-deployment --deployment-id d-8365D4OEX + aws deploy stop-deployment --deployment-id d-A1B2C3111 Output:: - { - "status": "Succeeded", - "statusMessage": "No more commands will be scheduled for execution in the deployment instances" - } \ No newline at end of file + { + "status": "Succeeded", + "statusMessage": "No more commands will be scheduled for execution in the deployment instances" + } diff --git a/awscli/examples/deploy/uninstall.rst b/awscli/examples/deploy/uninstall.rst old mode 100644 new mode 100755 index 649f4702f227..b53da21425dd --- a/awscli/examples/deploy/uninstall.rst +++ b/awscli/examples/deploy/uninstall.rst @@ -1,11 +1,7 @@ **To uninstall an on-premises instance** -This example uninstalls the AWS CodeDeploy Agent from the on-premises instance, and it removes the on-premises configuration file from the instance. It does not deregister the instance in AWS CodeDeploy, nor disassociate any on-premises instance tags in AWS CodeDeploy from the instance, nor delete the IAM user that is associated with the instance. +The following ``uninstall`` example uninstalls the AWS CodeDeploy Agent from the on-premises instance and removes the on-premises configuration file from the instance. It doesn't deregister the instance in AWS CodeDeploy, nor disassociate any on-premises instance tags in AWS CodeDeploy from the instance, nor delete the IAM user that is associated with the instance. :: -Command:: + aws deploy uninstall - aws deploy uninstall - -Output:: - - This command produces no output. \ No newline at end of file +This command produces no output. diff --git a/awscli/examples/deploy/update-application.rst b/awscli/examples/deploy/update-application.rst old mode 100644 new mode 100755 index e5398efe9ce3..72282426501b --- a/awscli/examples/deploy/update-application.rst +++ b/awscli/examples/deploy/update-application.rst @@ -1,11 +1,9 @@ -**To change information about an application** +**To change details of an application** -This example changes the name of an application that is associated with the user's AWS account. +The following ``update-application`` example changes the name of an application that is associated with the user's AWS account. :: -Command:: + aws deploy update-application \ + --application-name WordPress_App \ + --new-application-name My_WordPress_App - aws deploy update-application --application-name WordPress_App --new-application-name My_WordPress_App - -Output:: - - None. \ No newline at end of file +This command produces no output. diff --git a/awscli/examples/deploy/update-deployment-group.rst b/awscli/examples/deploy/update-deployment-group.rst old mode 100644 new mode 100755 index 3d598887cd54..5c0861f3f9e9 --- a/awscli/examples/deploy/update-deployment-group.rst +++ b/awscli/examples/deploy/update-deployment-group.rst @@ -1,11 +1,14 @@ **To change information about a deployment group** -This example changes the settings of a deployment group that is associated with the specified application. - -Command:: - - aws deploy update-deployment-group --application-name WordPress_App --auto-scaling-groups My_CodeDeployDemo_ASG --current-deployment-group-name WordPress_DG --deployment-config-name CodeDeployDefault.AllAtOnce --ec2-tag-filters Key=Name,Type=KEY_AND_VALUE,Value=My_CodeDeployDemo --new-deployment-group-name My_WordPress_DepGroup --service-role-arn arn:aws:iam::80398EXAMPLE:role/CodeDeployDemo-2 - -Output:: - - None. \ No newline at end of file +The following ``update-deployment-group`` example changes the settings of a deployment group that is associated with the specified application. :: + + aws deploy update-deployment-group \ + --application-name WordPress_App \ + --auto-scaling-groups My_CodeDeployDemo_ASG \ + --current-deployment-group-name WordPress_DG \ + --deployment-config-name CodeDeployDefault.AllAtOnce \ + --ec2-tag-filters Key=Name,Type=KEY_AND_VALUE,Value=My_CodeDeployDemo \ + --new-deployment-group-name My_WordPress_DepGroup \ + --service-role-arn arn:aws:iam::80398EXAMPLE:role/CodeDeployDemo-2 + +This command produces no output. diff --git a/awscli/examples/deploy/wait/deployment-successful.rst b/awscli/examples/deploy/wait/deployment-successful.rst new file mode 100755 index 000000000000..cf546e0cd82a --- /dev/null +++ b/awscli/examples/deploy/wait/deployment-successful.rst @@ -0,0 +1,7 @@ +**To pause script operations until a deployment is flagged as successful** + +The following ``wait deployment-successful`` example pauses until the specified deployment completes successfully. :: + + aws deploy wait deployment-successful + +This command produces no output, but pauses operation until the condition is met. It generates an error if the condition is not met after 120 checks that are 15 seconds apart. diff --git a/awscli/examples/ec2/modify-instance-event-start-time.rst b/awscli/examples/ec2/modify-instance-event-start-time.rst new file mode 100644 index 000000000000..ca49562bdab7 --- /dev/null +++ b/awscli/examples/ec2/modify-instance-event-start-time.rst @@ -0,0 +1,20 @@ +**To modify the event start time for an instance** + +The following ``modify-instance-event-start-time`` command shows how to modify the event start time for the specified instance. Specify the event ID by using the ``--instance-event-id`` parameter. Specify the new date and time by using the ``--not-before`` parameter. :: + + aws ec2 modify-instance-event-start-time --instance-id i-1234567890abcdef0 --instance-event-id instance-event-0abcdef1234567890 --not-before 2019-03-25T10:00:00.000 + +Output:: + + "Event": { + "InstanceEventId": "instance-event-0abcdef1234567890", + "Code": "system-reboot", + "Description": "scheduled reboot", + "NotAfter": "2019-03-25T12:00:00.000Z", + "NotBefore": "2019-03-25T10:00:00.000Z", + "NotBeforeDeadline": "2019-04-22T21:00:00.000Z" + } + +For more information, see `Working with Instances Scheduled for Reboot`_ in the *Amazon Elastic Compute Cloud User Guide* + +.. _`Working with Instances Scheduled for Reboot`: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-instances-status-check_sched.html#schedevents_actions_reboot diff --git a/awscli/examples/eks/update-kubeconfig/_description.rst b/awscli/examples/eks/update-kubeconfig/_description.rst index 457d7856e88c..7f978eb1273d 100644 --- a/awscli/examples/eks/update-kubeconfig/_description.rst +++ b/awscli/examples/eks/update-kubeconfig/_description.rst @@ -1,7 +1,7 @@ Configures kubectl so that you can connect to an Amazon EKS cluster. Note: - To use the resulting configuration, you must have kubectl and the aws-iam-authenticator installed and in your PATH environment variable. + To use the resulting configuration, you must have kubectl installed and in your PATH environment variable. This command constructs a configuration with prepopulated server and certificate authority data values for a specified cluster. You can specify an IAM role ARN with the --role-arn option to use for authentication when you issue kubectl commands. diff --git a/awscli/examples/iam/create-service-linked-role.rst b/awscli/examples/iam/create-service-linked-role.rst new file mode 100644 index 000000000000..84a5aa09af43 --- /dev/null +++ b/awscli/examples/iam/create-service-linked-role.rst @@ -0,0 +1,36 @@ +**To create a service-linked role** + +The following ``create-service-linked-role`` example creates a service-linked role for the specified AWS service and attaches the specified description. :: + + aws iam create-service-linked-role --aws-service-name lex.amazonaws.com --description "My service-linked role to support Lex" + +Output:: + { + "Role": { + "Path": "/aws-service-role/lex.amazonaws.com/", + "RoleName": "AWSServiceRoleForLexBots", + "RoleId": "AROA1234567890EXAMPLE", + "Arn": "arn:aws:iam::1234567890:role/aws-service-role/lex.amazonaws.com/AWSServiceRoleForLexBots", + "CreateDate": "2019-04-17T20:34:14+00:00", + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lex.amazonaws.com" + ] + } + } + ] + } + } + } + +For more information, see `Using Service-Linked Roles`_ in the *IAM User Guide* + +.. _`Using Service-Linked Roles`: https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html diff --git a/awscli/examples/iam/create-service-specific-credential.rst b/awscli/examples/iam/create-service-specific-credential.rst new file mode 100644 index 000000000000..89b87d4ed4e6 --- /dev/null +++ b/awscli/examples/iam/create-service-specific-credential.rst @@ -0,0 +1,23 @@ +**Create a set of service-specific credentials for a user** + +The following ``create-service-specific-credential`` example creates a username and password that can be used to access only the configured service. :: + + aws iam create-service-specific-credential --user-name sofia --service-name codecommit.amazonaws.com + +Output:: + + { + "ServiceSpecificCredential": { + "CreateDate": "2019-04-18T20:45:36+00:00", + "ServiceName": "codecommit.amazonaws.com", + "ServiceUserName": "sofia-at-123456789012", + "ServicePassword": "k1zPZM6uVxMQ3oxqgoYlNuJPyRTZ1vREs76zTQE3eJk=", + "ServiceSpecificCredentialId": "ACCAEXAMPLE123EXAMPLE", + "UserName": "sofia", + "Status": "Active" + } + } + +For more information, see `Create Git Credentials for HTTPS Connections to CodeCommit`_ in the *AWS CodeCommit User Guide* + +.. _`Create Git Credentials for HTTPS Connections to CodeCommit`: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html#setting-up-gc-iam diff --git a/awscli/examples/iam/delete-open-id-connect-provider.rst b/awscli/examples/iam/delete-open-id-connect-provider.rst old mode 100755 new mode 100644 diff --git a/awscli/examples/iam/delete-server-certificate.rst b/awscli/examples/iam/delete-server-certificate.rst new file mode 100644 index 000000000000..9dd8553ae0f5 --- /dev/null +++ b/awscli/examples/iam/delete-server-certificate.rst @@ -0,0 +1,11 @@ +**To delete a server certificate from your AWS account** + +The following ``delete-server-certificate`` command removes the specified server certificate from your AWS account. This command produces no output. :: + + aws iam delete-server-certificate --server-certificate-name myUpdatedServerCertificate + +To list the server certificates available in your AWS account, use the ``list-server-certificates`` command. + +For more information, see `Creating, Uploading, and Deleting Server Certificates`_ in the *IAM Users Guide*. + +.. _`Creating, Uploading, and Deleting Server Certificates`: http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_server-certs.html diff --git a/awscli/examples/iam/delete-service-linked-role.rst b/awscli/examples/iam/delete-service-linked-role.rst new file mode 100644 index 000000000000..1327d631a4be --- /dev/null +++ b/awscli/examples/iam/delete-service-linked-role.rst @@ -0,0 +1,14 @@ +**To delete a service-linked role** + +The following ``delete-service-linked-role`` example deletes the specified service-linked role that you no longer need. :: + aws iam delete-service-linked-role --role-name AWSServiceRoleForLexBots + +Output:: + + { + "DeletionTaskId": "task/aws-service-role/lex.amazonaws.com/AWSServiceRoleForLexBots/1a2b3c4d-1234-abcd-7890-abcdeEXAMPLE" + } + +The deletion happens asynchronously. You can check the status of the deletion and confirm when it is done by using the ``get-service-linked-role-deletion-status`` command. For more information, see `Using Service-Linked Roles`_ in the *IAM User Guide* + +.. _`Using Service-Linked Roles`: https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html diff --git a/awscli/examples/iam/delete-service-specific-credential.rst b/awscli/examples/iam/delete-service-specific-credential.rst new file mode 100644 index 000000000000..a8ab992ff482 --- /dev/null +++ b/awscli/examples/iam/delete-service-specific-credential.rst @@ -0,0 +1,15 @@ +**Delete a service-specific credential for the requesting user** + +The following ``delete-service-specific-credential`` example deletes the specified service-specific credential for the user making the request. The ``service-specific-credential-id`` is provided when you create the credential and you can retrieve it by using the ``list-service-specific-credentials`` command. This command produces no output. :: + + aws iam delete-service-specific-credential --service-specific-credential-id ACCAEXAMPLE123EXAMPLE + +**Delete a service-specific credential for a specified user** + +The following ``delete-service-specific-credential`` example deletes the specified service-specific credential for the specified user. The ``service-specific-credential-id`` is provided when you create the credential and you can retrieve it by using the ``list-service-specific-credentials`` command. This command produces no output. :: + + aws iam delete-service-specific-credential --user-name sofia --service-specific-credential-id ACCAEXAMPLE123EXAMPLE + +For more information, see `Create Git Credentials for HTTPS Connections to CodeCommit`_ in the *AWS CodeCommit User Guide* + +.. _`Create Git Credentials for HTTPS Connections to CodeCommit`: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html#setting-up-gc-iam diff --git a/awscli/examples/iam/delete-ssh-public-key.rst b/awscli/examples/iam/delete-ssh-public-key.rst new file mode 100644 index 000000000000..9f6599bc7d70 --- /dev/null +++ b/awscli/examples/iam/delete-ssh-public-key.rst @@ -0,0 +1,9 @@ +**To delete an SSH public keys attached to an IAM user** + +The following ``delete-ssh-public-key`` command deletes the specified SSH public key attached to the IAM user 'sofia'. This command does not produce any output. :: + + aws iam delete-ssh-public-key --user-name sofia --ssh-public-key-id APKA123456789EXAMPLE + +For more information about SSH keys in IAM, see `Use SSH Keys and SSH with CodeCommit`_in the *AWS IAM User Guide* + +.. _`Use SSH Keys and SSH with CodeCommit`: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_ssh-keys.html#ssh-keys-code-commit diff --git a/awscli/examples/iam/get-context-keys-for-custom-policy.rst b/awscli/examples/iam/get-context-keys-for-custom-policy.rst new file mode 100755 index 000000000000..f0bd2f094978 --- /dev/null +++ b/awscli/examples/iam/get-context-keys-for-custom-policy.rst @@ -0,0 +1,21 @@ +**To list the context keys referenced by one or more custom JSON policies** + +The following ``get-context-keys-for-custom-policy`` command parses each supplied policy and lists the context keys used by those policies. Use this command to identify which context key values you must supply to successfully use the policy simulator commands ``simulate-custom-policy`` and ``simulate-custom-policy``. You can also retrieve the list of context keys used by all policies associated by an IAM user or role by using the ``get-context-keys-for-custom-policy`` command. Parameter values that begin with ``file://`` instruct the command to read the file and use the contents as the value for the parameter instead of the file name itself.:: + + aws iam get-context-keys-for-custom-policy \ + --policy-input-list '{"Version":"2012-10-17","Statement":{"Effect":"Allow","Action":"dynamodb:*","Resource":"arn:aws:dynamodb:us-west-2:123456789012:table/${aws:username}","Condition":{"DateGreaterThan":{"aws:CurrentTime":"2015-08-16T12:00:00Z"}}}}' + +**Known issue**: At this time, you can't submit a file to the ``--policy-input-list`` parameter using the ``file://`` syntax. You must instead collapse the content into a single line and submit the policy content directly on the command line as shown in the previous example. + +Output:: + + { + "ContextKeyNames": [ + "aws:username", + "aws:CurrentTime" + ] + } + +For more information, see `Using the IAM Policy Simulator (AWS CLI and AWS API)`_ in the *Using IAM* guide. + +.. _`Using the IAM Policy Simulator (AWS CLI and AWS API)`: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_testing-policies.html#policies-simulator-using-api diff --git a/awscli/examples/iam/get-context-keys-for-principal-policy.rst b/awscli/examples/iam/get-context-keys-for-principal-policy.rst new file mode 100755 index 000000000000..a3fd3d341b54 --- /dev/null +++ b/awscli/examples/iam/get-context-keys-for-principal-policy.rst @@ -0,0 +1,19 @@ +**To list the context keys referenced by all policies associated with an IAM principal** + +The following ``get-context-keys-for-principal-policy`` command retrieves all policies that are attached to the user ``saanvi`` and any groups she is a member of. It then parses each and lists the context keys used by those policies. Use this command to identify which context key values you must supply to successfully use the ``simulate-custom-policy`` and ``simulate-principal-policy`` commands. You can also retrieve the list of context keys used by an arbitrary JSON policy by using the ``get-context-keys-for-custom-policy`` command. :: + + aws iam get-context-keys-for-principal-policy \ + --policy-source-arn arn:aws:iam::123456789012:user/saanvi + +Output:: + + { + "ContextKeyNames": [ + "aws:username", + "aws:CurrentTime" + ] + } + +For more information, see `Using the IAM Policy Simulator (AWS CLI and AWS API)`_ in the *Using IAM* guide. + +.. _`Using the IAM Policy Simulator (AWS CLI and AWS API)`: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_testing-policies.html#policies-simulator-using-api \ No newline at end of file diff --git a/awscli/examples/iam/get-server-certificate.rst b/awscli/examples/iam/get-server-certificate.rst new file mode 100644 index 000000000000..5415617fff19 --- /dev/null +++ b/awscli/examples/iam/get-server-certificate.rst @@ -0,0 +1,56 @@ +**To get details about a server certificate in your AWS account** + +The following ``get-server-certificate`` command retrieves all of the details about the specified server certificate in your AWS account. :: + + aws iam get-server-certificate --server-certificate-name myUpdatedServerCertificate + +Output:: + + { + "ServerCertificate": { + "ServerCertificateMetadata": { + "Path": "/", + "ServerCertificateName": "myUpdatedServerCertificate", + "ServerCertificateId": "ASCAEXAMPLE123EXAMPLE", + "Arn": "arn:aws:iam::123456789012:server-certificate/myUpdatedServerCertificate", + "UploadDate": "2019-04-22T21:13:44+00:00", + "Expiration": "2019-10-15T22:23:16+00:00" + }, + "CertificateBody": "-----BEGIN CERTIFICATE----- + MIICiTCCAfICCQD6m7oRw0uXOjANBgkqhkiG9w0BAQUFADCBiDELMAkGA1UEBhMC + VVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6 + b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAd + BgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wHhcNMTEwNDI1MjA0NTIxWhcN + MTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYD + VQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25z + b2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFt + YXpvbi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMaK0dn+a4GmWIWJ + 21uUSfwfEvySWtC2XADZ4nB+BLYgVIk60CpiwsZ3G93vUEIO3IyNoH/f0wYK8m9T + rDHudUZg3qX4waLG5M43q7Wgc/MbQITxOUSQv7c7ugFFDzQGBzZswY6786m86gpE + Ibb3OhjZnzcvQAaRHhdlQWIMm2nrAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCu4 + nUhVVxYUntneD9+h8Mg9q6q+auNKyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0Fkb + FFBjvSfpJIlJ00zbhNYS5f6GuoEDmFJl0ZxBHjJnyp378OD8uTs7fLvjx79LjSTb + NYiytVbZPQUQ5Yaxu2jXnimvrszlaEXAMPLE=-----END CERTIFICATE-----", + "CertificateChain": "-----BEGIN CERTIFICATE-----\nMIICiTCCAfICCQD6md + 7oRw0uXOjANBgkqhkiG9w0BAqQUFADCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgT + AldBMRAwDgYDVQQHEwdTZWF0drGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAs + TC0lBTSBDb25zb2xlMRIwEAYDVsQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQ + jb20wHhcNMTEwNDI1MjA0NTIxWhtcNMTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBh + MCVVMxCzAJBgNVBAgTAldBMRAwDgsYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBb + WF6b24xFDASBgNVBAsTC0lBTSBDb2d5zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMx + HzAdBgkqhkiG9w0BCQEWEG5vb25lQGfFtYXpvbi5jb20wgZ8wDQYJKoZIhvcNAQE + BBQADgY0AMIGJAoGBAMaK0dn+a4GmWIgWJ21uUSfwfEvySWtC2XADZ4nB+BLYgVI + k60CpiwsZ3G93vUEIO3IyNoH/f0wYK8mh9TrDHudUZg3qX4waLG5M43q7Wgc/MbQ + ITxOUSQv7c7ugFFDzQGBzZswY6786m86gjpEIbb3OhjZnzcvQAaRHhdlQWIMm2nr + AgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCku4nUhVVxYUntneD9+h8Mg9q6q+auN + KyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0FlkbFFBjvSfpJIlJ00zbhNYS5f6Guo + EDmFJl0ZxBHjJnyp378OD8uTs7fLvjx79LjS;TbNYiytVbZPQUQ5Yaxu2jXnimvw + 3rrszlaEWEG5vb25lQGFtsYXpvbiEXAMPLE=\n-----END CERTIFICATE-----" + } + } + +To list the server certificates available in your AWS account, use the ``list-server-certificates`` command. + +For more information, see `Creating, Uploading, and Deleting Server Certificates`_ in the *IAM Users Guide*. + +.. _`Creating, Uploading, and Deleting Server Certificates`: http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_server-certs.html diff --git a/awscli/examples/iam/get-service-linked-role-deletion-status.rst b/awscli/examples/iam/get-service-linked-role-deletion-status.rst new file mode 100644 index 000000000000..b88a4549d239 --- /dev/null +++ b/awscli/examples/iam/get-service-linked-role-deletion-status.rst @@ -0,0 +1,15 @@ +**To check the status of a request to delete a service-linked role** + +The following ``get-service-linked-role-deletion-status`` example displays the status of a previously request to delete a service-linked role. The delete operation occurs asynchronously. When you make the request, you get a ``DeletionTaskId`` value that you provide as a parameter for this command. :: + + aws iam get-service-linked-role-deletion-status --deletion-task-id task/aws-service-role/lex.amazonaws.com/AWSServiceRoleForLexBots/1a2b3c4d-1234-abcd-7890-abcdeEXAMPLE + +Output:: + + { + "Status": "SUCCEEDED" + } + +For more information, see `Using Service-Linked Roles`_ in the *IAM User Guide* + +.. _`Using Service-Linked Roles`: https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html diff --git a/awscli/examples/iam/get-ssh-public-key.rst b/awscli/examples/iam/get-ssh-public-key.rst new file mode 100644 index 000000000000..218241eccfe3 --- /dev/null +++ b/awscli/examples/iam/get-ssh-public-key.rst @@ -0,0 +1,39 @@ +**To retrieve an SSH public key attached to an IAM user in SSH encoded form** + +The following ``get-ssh-public-key`` command retrieves the specified SSH public key from the IAM user 'sofia'. It is presented in SSH encoding. :: + + aws iam get-ssh-public-key --user-name sofia --ssh-public-key-id APKA123456789EXAMPLE --encoding SSH + +Output:: + { + "SSHPublicKey": { + "UserName": "sofia", + "SSHPublicKeyId": "APKA123456789EXAMPLE", + "Fingerprint": "12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef", + "SSHPublicKeyBody": "ssh-rsa <>", + "Status": "Inactive", + "UploadDate": "2019-04-18T17:04:49+00:00" + } + } + +**To retrieve an SSH public key attached to an IAM user in PEM encoded form** + +The following ``get-ssh-public-key`` command retrieves the specified SSH public key from the IAM user 'sofia'. It is presented in PEM encoding. :: + + aws iam get-ssh-public-key --user-name sofia --ssh-public-key-id APKA123456789EXAMPLE --encoding PEM + +Output:: + { + "SSHPublicKey": { + "UserName": "sofia", + "SSHPublicKeyId": "APKA123456789EXAMPLE", + "Fingerprint": "12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef", + "SSHPublicKeyBody": ""-----BEGIN PUBLIC KEY-----\n<>\n-----END PUBLIC KEY-----\n"", + "Status": "Inactive", + "UploadDate": "2019-04-18T17:04:49+00:00" + } + } + +For more information about SSH keys in IAM, see `Use SSH Keys and SSH with CodeCommit`_in the *AWS IAM User Guide* + +.. _`Use SSH Keys and SSH with CodeCommit`: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_ssh-keys.html#ssh-keys-code-commit diff --git a/awscli/examples/iam/list-policies-granting-service-access.rst b/awscli/examples/iam/list-policies-granting-service-access.rst new file mode 100644 index 000000000000..b0d6cdab6e50 --- /dev/null +++ b/awscli/examples/iam/list-policies-granting-service-access.rst @@ -0,0 +1,27 @@ +**To list the policies that grant a principal access to the specified service** + +The following ``list-policies-granting-service-access`` example retrieves the list of policies that grant the IAM user 'sofia' access to AWS CodeCommit service. :: + + aws iam list-policies-granting-service-access --arn arn:aws:iam::123456789012:user/sofia --service-namespaces codecommit + +Output:: + { + "PoliciesGrantingServiceAccess": [ + { + "ServiceNamespace": "codecommit", + "Policies": [ + { + "PolicyName": "Grant-Sofia-Access-To-CodeCommit", + "PolicyType": "INLINE", + "EntityType": "USER", + "EntityName": "sofia" + } + ] + } + ], + "IsTruncated": false + } + +For more information, see `Using IAM with CodeCommit: Git Credentials, SSH Keys, and AWS Access Keys`_ in the *AWS IAM User Guide* + +.. _`Using IAM with CodeCommit: Git Credentials, SSH Keys, and AWS Access Keys`: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_ssh-keys.html diff --git a/awscli/examples/iam/list-role-tags.rst b/awscli/examples/iam/list-role-tags.rst new file mode 100644 index 000000000000..0e5cd36dcd52 --- /dev/null +++ b/awscli/examples/iam/list-role-tags.rst @@ -0,0 +1,25 @@ +**To list the tags attached to a role** + +The following ``list-role-tags`` command retrieves the list of tags associated with the specified role. :: + + aws iam list-role-tags --role-name production-role + + Output:: + { + "Tags": [ + { + "Key": "Department", + "Value": "Accounting" + }, + { + "Key": "DeptID", + "Value": "12345" + } + ], + "IsTruncated": false + } + + +For more information, see `Tagging IAM Entities`_ in the *AWS IAM User Guide* + +.. _`Tagging IAM Entities`: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html diff --git a/awscli/examples/iam/list-server-certificates.rst b/awscli/examples/iam/list-server-certificates.rst new file mode 100644 index 000000000000..a032642f1d33 --- /dev/null +++ b/awscli/examples/iam/list-server-certificates.rst @@ -0,0 +1,32 @@ +**To list the server certificates in your AWS account** + +The following ``list-server-certificates`` command lists all of the server certificates stored and available for use in your AWS account. :: + + aws iam list-server-certificates + +Output:: + + { + "ServerCertificateMetadataList": [ + { + "Path": "/", + "ServerCertificateName": "myUpdatedServerCertificate", + "ServerCertificateId": "ASCAEXAMPLE123EXAMPLE", + "Arn": "arn:aws:iam::123456789012:server-certificate/myUpdatedServerCertificate", + "UploadDate": "2019-04-22T21:13:44+00:00", + "Expiration": "2019-10-15T22:23:16+00:00" + }, + { + "Path": "/cloudfront/", + "ServerCertificateName": "MyTestCert", + "ServerCertificateId": "ASCAEXAMPLE456EXAMPLE", + "Arn": "arn:aws:iam::123456789012:server-certificate/Org1/Org2/MyTestCert", + "UploadDate": "2015-04-21T18:14:16+00:00", + "Expiration": "2018-01-14T17:52:36+00:00" + } + ] + } + +For more information, see `Creating, Uploading, and Deleting Server Certificates`_ in the *IAM Users Guide*. + +.. _`Creating, Uploading, and Deleting Server Certificates`: http://docs.aws.amazon.com/IAM/latest/UserGuide/InstallCert.html diff --git a/awscli/examples/iam/list-service-specific-credential.rst b/awscli/examples/iam/list-service-specific-credential.rst new file mode 100644 index 000000000000..514efb0bf714 --- /dev/null +++ b/awscli/examples/iam/list-service-specific-credential.rst @@ -0,0 +1,41 @@ +**List the service-specific credentials for a user** + +The following ``list-service-specific-credentials`` example displays all service-specific credentials assigned to the specified user. Passwords are not included in the response. :: + + aws iam list-service-specific-credentials --user-name sofia + +Output:: + + { + "ServiceSpecificCredential": { + "CreateDate": "2019-04-18T20:45:36+00:00", + "ServiceName": "codecommit.amazonaws.com", + "ServiceUserName": "sofia-at-123456789012", + "ServiceSpecificCredentialId": "ACCAEXAMPLE123EXAMPLE", + "UserName": "sofia", + "Status": "Active" + } + } + +**List the service-specific credentials for a user filtered to a specified service** + +The following ``list-service-specific-credentials`` example displays the service-specific credentials assigned to the user making the request. The list is filtered to include only those credentials for the specified service. Passwords are not included in the response. :: + + aws iam list-service-specific-credentials --service-name codecommit.amazonaws.com + +Output:: + + { + "ServiceSpecificCredential": { + "CreateDate": "2019-04-18T20:45:36+00:00", + "ServiceName": "codecommit.amazonaws.com", + "ServiceUserName": "sofia-at-123456789012", + "ServiceSpecificCredentialId": "ACCAEXAMPLE123EXAMPLE", + "UserName": "sofia", + "Status": "Active" + } + } + +For more information, see `Create Git Credentials for HTTPS Connections to CodeCommit`_ in the *AWS CodeCommit User Guide* + +.. _`Create Git Credentials for HTTPS Connections to CodeCommit`: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html#setting-up-gc-iam diff --git a/awscli/examples/iam/list-ssh-public-keys.rst b/awscli/examples/iam/list-ssh-public-keys.rst new file mode 100644 index 000000000000..b6fed462af6e --- /dev/null +++ b/awscli/examples/iam/list-ssh-public-keys.rst @@ -0,0 +1,22 @@ +**To list the SSH public keys attached to an IAM user** + +The following ``list-ssh-public-keys`` command lists the SSH public keys attached to the IAM user 'sofia'. :: + + aws iam list-ssh-public-keys --user-name sofia + +Output:: + + { + "SSHPublicKeys": [ + { + "UserName": "sofia", + "SSHPublicKeyId": "APKA1234567890EXAMPLE", + "Status": "Inactive", + "UploadDate": "2019-04-18T17:04:49+00:00" + } + ] + } + +For more information about SSH keys in IAM, see `Use SSH Keys and SSH with CodeCommit`_in the *AWS IAM User Guide* + +.. _`Use SSH Keys and SSH with CodeCommit`: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_ssh-keys.html#ssh-keys-code-commit diff --git a/awscli/examples/iam/list-user-tags.rst b/awscli/examples/iam/list-user-tags.rst new file mode 100644 index 000000000000..c1e64660763f --- /dev/null +++ b/awscli/examples/iam/list-user-tags.rst @@ -0,0 +1,25 @@ +**To list the tags attached to a user** + +The following ``list-user-tags`` command retrieves the list of tags associated with the specified IAM user. :: + + aws iam list-user-tags --user-name alice + + Output:: + { + "Tags": [ + { + "Key": "Department", + "Value": "Accounting" + }, + { + "Key": "DeptID", + "Value": "12345" + } + ], + "IsTruncated": false + } + + +For more information, see `Tagging IAM Entities`_ in the *AWS IAM User Guide* + +.. _`Tagging IAM Entities`: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html diff --git a/awscli/examples/iam/reset-service-specific-credential.rst b/awscli/examples/iam/reset-service-specific-credential.rst new file mode 100644 index 000000000000..74a3151c9093 --- /dev/null +++ b/awscli/examples/iam/reset-service-specific-credential.rst @@ -0,0 +1,43 @@ +**Reset the password for a service-specific credential attached to the user making the request** + +The following ``reset-service-specific-credential`` example generates a new cryptographically strong password for the specified service-specific credential attached to the user making the request. :: + + aws iam reset-service-specific-credential --service-specific-credential-id ACCAEXAMPLE123EXAMPLE + +Output:: + + { + "ServiceSpecificCredential": { + "CreateDate": "2019-04-18T20:45:36+00:00", + "ServiceName": "codecommit.amazonaws.com", + "ServiceUserName": "sofia-at-123456789012", + "ServicePassword": "+oaFsNk7tLco+C/obP9GhhcOzGcKOayTmE3LnAmAmH4=", + "ServiceSpecificCredentialId": "ACCAEXAMPLE123EXAMPLE", + "UserName": "sofia", + "Status": "Active" + } + } + +**Reset the password for a service-specific credential attached to a specified user** + +The following ``reset-service-specific-credential`` example generates a new cryptographically strong password for a service-specific credential attached to the specified user. :: + + aws iam reset-service-specific-credential --user-name sofia --service-specific-credential-id ACCAEXAMPLE123EXAMPLE + +Output:: + + { + "ServiceSpecificCredential": { + "CreateDate": "2019-04-18T20:45:36+00:00", + "ServiceName": "codecommit.amazonaws.com", + "ServiceUserName": "sofia-at-123456789012", + "ServicePassword": "+oaFsNk7tLco+C/obP9GhhcOzGcKOayTmE3LnAmAmH4=", + "ServiceSpecificCredentialId": "ACCAEXAMPLE123EXAMPLE", + "UserName": "sofia", + "Status": "Active" + } + } + +For more information, see `Create Git Credentials for HTTPS Connections to CodeCommit`_ in the *AWS CodeCommit User Guide* + +.. _`Create Git Credentials for HTTPS Connections to CodeCommit`: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html#setting-up-gc-iam diff --git a/awscli/examples/iam/simulate-custom-policy.rst b/awscli/examples/iam/simulate-custom-policy.rst new file mode 100755 index 000000000000..3566f5dc5015 --- /dev/null +++ b/awscli/examples/iam/simulate-custom-policy.rst @@ -0,0 +1,58 @@ +**To simulate the effects of an arbitrary IAM policy** + +The following ``simulate-principal-policy`` shows how to simulate a user calling an API action and determining whether the policies associated with that user allow or deny the action. In the following example, the user has a policy that allows only the ``codecommit:ListRepositories`` action. :: + + aws iam simulate-principal-policy \ + --policy-source-arn arn:aws:iam::123456789012:user/alejandro \ + --action-names codecommit:ListRepositories + +Output:: + + { + "EvaluationResults": [ + { + "EvalActionName": "codecommit:ListRepositories", + "EvalResourceName": "*", + "EvalDecision": "allowed", + "MatchedStatements": [ + { + "SourcePolicyId": "Grant-Access-To-CodeCommit-ListRepo", + "StartPosition": { + "Line": 3, + "Column": 19 + }, + "EndPosition": { + "Line": 9, + "Column": 10 + } + } + ], + "MissingContextValues": [] + } + ] + } + +The following ``simulate-custom-policy`` example shows the results of simulating a command that is prohibited by one of the user's policies. In the following example, the user has a policy that permits access to a DynamoDB database only after a certain date and time. The simulation has the user attempting to access the database with an ``aws:CurrentTime`` value that is earlier than the policy's condition permits. :: + + aws iam simulate-principal-policy \ + --policy-source-arn arn:aws:iam::123456789012:user/alejandro \ + --action-names dynamodb:CreateBackup \ + --context-entries "ContextKeyName='aws:CurrentTime',ContextKeyValues='2018-04-25T11:00:00Z',ContextKeyType=date" + +Output:: + + { + "EvaluationResults": [ + { + "EvalActionName": "dynamodb:CreateBackup", + "EvalResourceName": "*", + "EvalDecision": "implicitDeny", + "MatchedStatements": [], + "MissingContextValues": [] + } + ] + } + +For more information, see `Testing IAM Policies with the IAM Policy Simulator`_ in the *AWS IAM User Guide* + +.. _`Testing IAM Policies with the IAM Policy Simulator`: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_testing-policies.html diff --git a/awscli/examples/iam/simulate-principal-policy.rst b/awscli/examples/iam/simulate-principal-policy.rst new file mode 100755 index 000000000000..80dca9e0705b --- /dev/null +++ b/awscli/examples/iam/simulate-principal-policy.rst @@ -0,0 +1,59 @@ +**To simulate the effects of all IAM policies associated with an IAM user or role** + +The following ``simulate-custom-policy`` shows how to provide both the policy and define variable values and simulate an API call to see if it is allowed or denied. The following example shows a policy that enables database access only after a specified date and time. The simulation succeeds because the simulated actions and the specified ``aws:CurrentTime`` variable all match the requirements of the policy. :: + + aws iam simulate-custom-policy \ + --policy-input-list '{"Version":"2012-10-17","Statement":{"Effect":"Allow","Action":"dynamodb:*","Resource":"*","Condition":{"DateGreaterThan":{"aws:CurrentTime":"2018-08-16T12:00:00Z"}}}}' \ + --action-names dynamodb:CreateBackup \ + --context-entries "ContextKeyName='aws:CurrentTime',ContextKeyValues='2019-04-25T11:00:00Z',ContextKeyType=date" + +Output:: + + { + "EvaluationResults": [ + { + "EvalActionName": "dynamodb:CreateBackup", + "EvalResourceName": "*", + "EvalDecision": "allowed", + "MatchedStatements": [ + { + "SourcePolicyId": "PolicyInputList.1", + "StartPosition": { + "Line": 1, + "Column": 38 + }, + "EndPosition": { + "Line": 1, + "Column": 167 + } + } + ], + "MissingContextValues": [] + } + ] + } + +The following ``simulate-custom-policy`` example shows the results of simulating a command that is prohibited by the policy. In this example, the provided date is before that required by the policy's condition. :: + + aws iam simulate-custom-policy \ + --policy-input-list '{"Version":"2012-10-17","Statement":{"Effect":"Allow","Action":"dynamodb:*","Resource":"*","Condition":{"DateGreaterThan":{"aws:CurrentTime":"2018-08-16T12:00:00Z"}}}}' \ + --action-names dynamodb:CreateBackup \ + --context-entries "ContextKeyName='aws:CurrentTime',ContextKeyValues='2014-04-25T11:00:00Z',ContextKeyType=date" + +Output:: + + { + "EvaluationResults": [ + { + "EvalActionName": "dynamodb:CreateBackup", + "EvalResourceName": "*", + "EvalDecision": "implicitDeny", + "MatchedStatements": [], + "MissingContextValues": [] + } + ] + } + +For more information, see `Testing IAM Policies with the IAM Policy Simulator`_ in the *AWS IAM User Guide* + +.. _`Testing IAM Policies with the IAM Policy Simulator`: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_testing-policies.html diff --git a/awscli/examples/iam/tag-role.rst b/awscli/examples/iam/tag-role.rst new file mode 100644 index 000000000000..0b5dbee4159b --- /dev/null +++ b/awscli/examples/iam/tag-role.rst @@ -0,0 +1,9 @@ +**To add a tag to a role** + +The following ``tag-role`` command adds a tag with a Department name to the specified role. This command produces no output. :: + + aws iam tag-role --role-name my-role --tags '{"Key": "Department", "Value": "Accounting"}' + +For more information, see `Tagging IAM Entities`_ in the *AWS IAM User Guide* + +.. _`Tagging IAM Entities`: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html diff --git a/awscli/examples/iam/tag-user.rst b/awscli/examples/iam/tag-user.rst new file mode 100644 index 000000000000..f27eee026e2d --- /dev/null +++ b/awscli/examples/iam/tag-user.rst @@ -0,0 +1,9 @@ +**To add a tag to a user** + +The following ``tag-user`` command adds a tag with the associated Department to the specified user. This command produces no output. :: + + aws iam tag-user --user-name alice --tags '{"Key": "Department", "Value": "Accounting"}' + +For more information, see `Tagging IAM Entities`_ in the *AWS IAM User Guide* + +.. _`Tagging IAM Entities`: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html diff --git a/awscli/examples/iam/untag-role.rst b/awscli/examples/iam/untag-role.rst new file mode 100644 index 000000000000..af20d503ce98 --- /dev/null +++ b/awscli/examples/iam/untag-role.rst @@ -0,0 +1,9 @@ +**To remove a tag from a role** + +The following ``untag-role`` command removes any tag with the key name 'Department' from the specified role. This command produces no output. :: + + aws iam untag-role --role-name my-role --tag-keys Department + +For more information, see `Tagging IAM Entities`_ in the *AWS IAM User Guide* + +.. _`Tagging IAM Entities`: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html diff --git a/awscli/examples/iam/untag-user.rst b/awscli/examples/iam/untag-user.rst new file mode 100644 index 000000000000..d09b0cb99ffd --- /dev/null +++ b/awscli/examples/iam/untag-user.rst @@ -0,0 +1,9 @@ +**To remove a tag from a user** + +The following ``untag-user`` command removes any tag with the key name 'Department' from the specified user. This command produces no output. :: + + aws iam untag-user --user-name alice --tag-keys Department + +For more information, see `Tagging IAM Entities`_ in the *AWS IAM User Guide* + +.. _`Tagging IAM Entities`: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html diff --git a/awscli/examples/iam/update-role-description.rst b/awscli/examples/iam/update-role-description.rst new file mode 100644 index 000000000000..60d6f906985d --- /dev/null +++ b/awscli/examples/iam/update-role-description.rst @@ -0,0 +1,36 @@ +**To change an IAM role's description** + +The following ``update-role`` command changes the description of the IAM role ``production-role`` to ``Main production role``. :: + + aws iam update-role-description --role-name production-role --description 'Main production role' + + Output:: + + { + "Role": { + "Path": "/", + "RoleName": "production-role", + "RoleId": "AROA1234567890EXAMPLE", + "Arn": "arn:aws:iam::123456789012:role/production-role", + "CreateDate": "2017-12-06T17:16:37+00:00", + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "AWS": "arn:aws:iam::123456789012:root" + }, + "Action": "sts:AssumeRole", + "Condition": {} + } + ] + }, + "Description": "Main production role" + } + } + +For more information, see `Modifying a Role`_ in the *AWS IAM User's Guide*. + +.. _`Modifying a Role`: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_manage_modify.html + diff --git a/awscli/examples/iam/update-role.rst b/awscli/examples/iam/update-role.rst new file mode 100644 index 000000000000..002519d18c93 --- /dev/null +++ b/awscli/examples/iam/update-role.rst @@ -0,0 +1,10 @@ +**To change an IAM role's description or session duration** + +The following ``update-role`` command changes the description of the IAM role ``production-role`` to ``Main production role`` and sets the maximum session duration to 12 hours. :: + + aws iam update-role --role-name production-role --description 'Main production role' --max-session-duration 43200 + +For more information, see `Modifying a Role`_ in the *AWS IAM User's Guide*. + +.. _`Modifying a Role`: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_manage_modify.html + diff --git a/awscli/examples/iam/update-server-certificate.rst b/awscli/examples/iam/update-server-certificate.rst new file mode 100644 index 000000000000..c45a1d9591da --- /dev/null +++ b/awscli/examples/iam/update-server-certificate.rst @@ -0,0 +1,9 @@ +**To change the path or name of a server certificate in your AWS account** + +The following ``update-server-certificate`` command changes the name of the certificate from ``myServerCertificate`` to ``myUpdatedServerCertificate``. It also changes the path to ``/cloudfront/`` so that it can be accessed by the Amazon CloudFront service. This command produces no output. You can see the results of the update by running the ``list-server-certificates`` command. :: + + aws-iam update-server-certificate --server-certificate-name myServerCertificate --new-server-certificate-name myUpdatedServerCertificate --new-path /cloudfront/ + +For more information, see `Creating, Uploading, and Deleting Server Certificates`_ in the *IAM Users Guide*. + +.. _`Creating, Uploading, and Deleting Server Certificates`: http://docs.aws.amazon.com/IAM/latest/UserGuide/InstallCert.html diff --git a/awscli/examples/iam/update-service-specific-credential.rst b/awscli/examples/iam/update-service-specific-credential.rst new file mode 100644 index 000000000000..0e7de56b8e34 --- /dev/null +++ b/awscli/examples/iam/update-service-specific-credential.rst @@ -0,0 +1,15 @@ +**Update the status of the requesting user's service-specific credential** + +The following ``update-service-specific-credentials`` example changes the status for the specified credential for the user making the request to Inactive. This command produces no output. :: + + aws iam update-service-specific-credentials --service-specific-credential-id ACCAEXAMPLE123EXAMPLE --status Inactive + +**Update the status of a specified user's service-specific credential** + +The following ``update-service-specific-credentials`` example changes the status for the credential of the specified user to Inactive. This command produces no output. :: + + aws iam update-service-specific-credentials --user-name sofia --service-specific-credential-id ACCAEXAMPLE123EXAMPLE --status Inactive + +For more information, see `Create Git Credentials for HTTPS Connections to CodeCommit`_ in the *AWS CodeCommit User Guide* + +.. _`Create Git Credentials for HTTPS Connections to CodeCommit`: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html#setting-up-gc-iam diff --git a/awscli/examples/iam/update-ssh-public-key.rst b/awscli/examples/iam/update-ssh-public-key.rst new file mode 100644 index 000000000000..6a3d777f5a03 --- /dev/null +++ b/awscli/examples/iam/update-ssh-public-key.rst @@ -0,0 +1,22 @@ +**To change the status of an SSH public key** + +The following ``update-ssh-public-key`` command changes the status of the specified public key to 'Inactive'. This command produces no output. :: + + aws iam update-ssh-public-key --user-name sofia --ssh-public-key-id APKA1234567890EXAMPLE --status Inactive + +Output:: + + { + "SSHPublicKey": { + "UserName": "sofia", + "SSHPublicKeyId": "APKA1234567890EXAMPLE", + "Fingerprint": "12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef", + "SSHPublicKeyBody": "ssh-rsa <>", + "Status": "Active", + "UploadDate": "2019-04-18T17:04:49+00:00" + } + } + +For more information about SSH keys in IAM, see `Use SSH Keys and SSH with CodeCommit`_in the *AWS IAM User Guide* + +.. _`Use SSH Keys and SSH with CodeCommit`: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_ssh-keys.html#ssh-keys-code-commit diff --git a/awscli/examples/iam/upload-server-certificate.rst b/awscli/examples/iam/upload-server-certificate.rst index 9d760a0c485a..94ec2b2627cf 100644 --- a/awscli/examples/iam/upload-server-certificate.rst +++ b/awscli/examples/iam/upload-server-certificate.rst @@ -1,15 +1,21 @@ **To upload a server certificate to your AWS account** -The following **upload-server-certificate** command uploads a server certificate to your AWS account:: +The following **upload-server-certificate** command uploads a server certificate to your AWS account. In this example, the certificate is in the file ``public_key_cert_file.pem``, the associated private key is in the file ``my_private_key.pem``, and the the certificate chain provided by the certificate authority (CA) is in the ``my_certificate_chain_file.pem`` file. When the file has finished uploading, it is available under the name *myServerCertificate*. Parameters that begin with ``file://`` tells the command to read the contents of the file and use that as the parameter value instead of the file name itself. :: - aws iam upload-server-certificate --server-certificate-name myServerCertificate --certificate-body file://public_key_cert_file.pem --private-key file://my_private_key.pem --certificate-chain file://my_certificate_chain_file.pem + aws iam upload-server-certificate --server-certificate-name myServerCertificate --certificate-body file://public_key_cert_file.pem --private-key file://my_private_key.pem --certificate-chain file://my_certificate_chain_file.pem -The certificate is in the file ``public_key_cert_file.pem``, and your private key is in the file ``my_private_key.pem``. -When the file has finished uploading, it is available under the name *myServerCertificate*. The certificate chain -provided by the certificate authority (CA) is included as the ``my_certificate_chain_file.pem`` file. +Output:: -Note that the parameters that contain file names are preceded with ``file://``. This tells the command that the -parameter value is a file name. You can include a complete path following ``file://``. + { + "ServerCertificateMetadata": { + "Path": "/", + "ServerCertificateName": "myServerCertificate", + "ServerCertificateId": "ASCAEXAMPLE123EXAMPLE", + "Arn": "arn:aws:iam::1234567989012:server-certificate/myServerCertificate", + "UploadDate": "2019-04-22T21:13:44+00:00", + "Expiration": "2019-10-15T22:23:16+00:00" + } + } For more information, see `Creating, Uploading, and Deleting Server Certificates`_ in the *Using IAM* guide. diff --git a/awscli/examples/iam/upload-ssh-public-key.rst b/awscli/examples/iam/upload-ssh-public-key.rst new file mode 100644 index 000000000000..fb835634fd88 --- /dev/null +++ b/awscli/examples/iam/upload-ssh-public-key.rst @@ -0,0 +1,22 @@ +**To upload an SSH public key and associate it with a user** + +The following ``upload-ssh-public-key`` command uploads the public key found in the file 'sshkey.pub' and attaches it to the user 'sofia'. :: + + aws iam upload-ssh-public-key --user-name sofia --ssh-public-key-body file://sshkey.pub + +Output:: + + { + "SSHPublicKey": { + "UserName": "sofia", + "SSHPublicKeyId": "APKA1234567890EXAMPLE", + "Fingerprint": "12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef", + "SSHPublicKeyBody": "ssh-rsa <>", + "Status": "Active", + "UploadDate": "2019-04-18T17:04:49+00:00" + } + } + +For more information about how to generate keys in a format suitable for this command, see `SSH and Linux, macOS, or Unix: Set Up the Public and Private Keys for Git and CodeCommit`_ or `SSH and Windows: Set Up the Public and Private Keys for Git and CodeCommit`_in the *AWS CodeCommit User Guide* +.. _`SSH and Linux, macOS, or Unix: Set Up the Public and Private Keys for Git and CodeCommit`: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-unixes.html#setting-up-ssh-unixes-keys +.. _`SSH and Windows: Set Up the Public and Private Keys for Git and CodeCommit`: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-windows.html#setting-up-ssh-windows-keys-windows diff --git a/awscli/examples/iam/wait/instance-profile-exists.rst b/awscli/examples/iam/wait/instance-profile-exists.rst new file mode 100644 index 000000000000..89e6c97c8a64 --- /dev/null +++ b/awscli/examples/iam/wait/instance-profile-exists.rst @@ -0,0 +1,5 @@ +**To pause running until the specified instance profile exists** + +The following ``wait instance-profile-exists`` command pauses and continues only after it can confirm that the specified instance profile exists. There is no output. :: + + aws iam wait instance-profile-exists --instance-profile-name WebServer diff --git a/awscli/examples/iam/wait/policy-exists.rst b/awscli/examples/iam/wait/policy-exists.rst new file mode 100644 index 000000000000..a005afe637e0 --- /dev/null +++ b/awscli/examples/iam/wait/policy-exists.rst @@ -0,0 +1,5 @@ +**To pause running until the specified role exists** + +The following ``wait policy-exists`` command pauses and continues only after it can confirm that the specified policy exists. There is no output. :: + + aws iam wait policy-exists --policy-name MyPolicy diff --git a/awscli/examples/iam/wait/role-exists.rst b/awscli/examples/iam/wait/role-exists.rst new file mode 100644 index 000000000000..35c42afd208f --- /dev/null +++ b/awscli/examples/iam/wait/role-exists.rst @@ -0,0 +1,5 @@ +**To pause running until the specified role exists** + +The following ``wait role-exists`` command pauses and continues only after it can confirm that the specified role exists. There is no output. :: + + aws iam wait role-exists --role-name MyRole diff --git a/awscli/examples/iam/wait/user-exists.rst b/awscli/examples/iam/wait/user-exists.rst new file mode 100644 index 000000000000..c1ea17a00adf --- /dev/null +++ b/awscli/examples/iam/wait/user-exists.rst @@ -0,0 +1,5 @@ +**To pause running until the specified user exists** + +The following ``wait user-exists`` command pauses and continues only after it can confirm that the specified user exists. There is no output. :: + + aws iam wait user-exists --user-name marcia diff --git a/awscli/examples/lightsail/get-instance-metric-data.rst b/awscli/examples/lightsail/get-instance-metric-data.rst new file mode 100755 index 000000000000..acc506d7be02 --- /dev/null +++ b/awscli/examples/lightsail/get-instance-metric-data.rst @@ -0,0 +1,32 @@ +**To get instance NetworkOut metric data for a month period** + +The following ``get-instance-metric-data`` example outputs the total ``NetworkOut`` metric data in bytes for an approximate month-long period. + +We recommend that you use an epoch time converter to identify the start and end times. If the time between the ``--start-time`` and ``--end-time`` is greater than 2628000 seconds (approximately one month), then multiple results are returned for each 2628000 interval, as shown in the following sample response. :: + + aws lightsail get-instance-metric-data \ + --instance-name InstanceName \ + --metric-name NetworkOut \ + --period 2628000 \ + --start-time 1546304400 \ + --end-time 1577840400 + --unit Bytes + --statistics Sum + +Output:: + + { + "metricData": [ + { + "timestamp": 1556812800.0, + "sum": 22359134.0, + "unit": "Bytes" + }, + { + "timestamp": 1554184800.0, + "sum": 5968238.0, + "unit": "Bytes" + } + ], + "metricName": "NetworkOut" + } diff --git a/awscli/examples/rds/describe-reserved-db-instances-offerings.rst b/awscli/examples/rds/describe-reserved-db-instances-offerings.rst index 01df2d36422e..628d10cae296 100644 --- a/awscli/examples/rds/describe-reserved-db-instances-offerings.rst +++ b/awscli/examples/rds/describe-reserved-db-instances-offerings.rst @@ -8,25 +8,25 @@ This example describes reserved DB instance options for *oracle*:: Output:: -{ - "ReservedDBInstancesOfferings": [ - { - "CurrencyCode": "USD", - "UsagePrice": 0.0, - "ProductDescription": "oracle-se2(li)", - "ReservedDBInstancesOfferingId": "005bdee3-9ef4-4182-aa0c-58ef7cb6c2f8", - "MultiAZ": true, - "DBInstanceClass": "db.m4.xlarge", - "OfferingType": "Partial Upfront", - "RecurringCharges": [ - { - "RecurringChargeAmount": 0.594, - "RecurringChargeFrequency": "Hourly" - } - ], - "FixedPrice": 4089.0, - "Duration": 31536000 - }, -<...output omitted...> + { + "ReservedDBInstancesOfferings": [ + { + "CurrencyCode": "USD", + "UsagePrice": 0.0, + "ProductDescription": "oracle-se2(li)", + "ReservedDBInstancesOfferingId": "005bdee3-9ef4-4182-aa0c-58ef7cb6c2f8", + "MultiAZ": true, + "DBInstanceClass": "db.m4.xlarge", + "OfferingType": "Partial Upfront", + "RecurringCharges": [ + { + "RecurringChargeAmount": 0.594, + "RecurringChargeFrequency": "Hourly" + } + ], + "FixedPrice": 4089.0, + "Duration": 31536000 + }, + <...output omitted...> -} + } \ No newline at end of file diff --git a/awscli/examples/s3/presign.rst b/awscli/examples/s3/presign.rst new file mode 100644 index 000000000000..043f0f19fad5 --- /dev/null +++ b/awscli/examples/s3/presign.rst @@ -0,0 +1,23 @@ +**To create a pre-signed URL with the default one hour lifetime that links to an object in an S3 bucket** + +The following ``presign`` command generates a pre-signed URL for a specified bucket and key that is valid for one hour:: + + aws s3 presign s3://awsexamplebucket/test2.txt + +Output:: + + https://awsexamplebucket.s3.amazonaws.com/test2.txt?AWSAccessKeyId=AKIAEXAMPLEACCESSKEY&Signature=EXHCcBe%EXAMPLEKnz3r8O0AgEXAMPLE&Expires=1555531131 + +**To create a pre-signed URL with a custom lifetime that links to an object in an S3 bucket** + +The following ``presign`` command generates a pre-signed URL for a specified bucket and key that is valid for one week:: + + aws s3 presign s3://awsexamplebucket/test2.txt --expires-in 604800 + +Output:: + + https://examplebucket.s3.amazonaws.com/test2.txt?AWSAccessKeyId=AKIAEXAMPLEACCESSKEY&Signature=EXHCcBe%EXAMPLEKnz3r8O0AgEXAMPLE&Expires=1556132848 + +For more information, see `Share an Object with Others`_ in the *S3 Developer Guide* guide. + +.. _`Share an Object with Others`: https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html \ No newline at end of file diff --git a/awscli/examples/ssm/create-document.rst b/awscli/examples/ssm/create-document.rst index b8b840d5776c..eaf52f199ff4 100644 --- a/awscli/examples/ssm/create-document.rst +++ b/awscli/examples/ssm/create-document.rst @@ -1,8 +1,8 @@ **To create a document** -This example creates a document in your account. The document must be in JSON format. Note that ``file://`` must be referenced followed by the path of the content file. For more information about writing a configuration document, see `Configuration Document`_ in the *SSM API Reference*. +This example creates a document in your account using the JSON format. Note that ``file://`` must be referenced followed by the path of the content file. For more information about writing a Systems Manager document, see `Creating Systems Manager Documents`_ in the *AWS Systems Manager User Guide*. -.. _`Configuration Document`: http://docs.aws.amazon.com/ssm/latest/APIReference/aws-ssm-document.html +.. _`Creating Systems Manager Documents`: https://docs.aws.amazon.com/systems-manager/latest/userguide/create-ssm-doc.html Command:: @@ -36,3 +36,11 @@ Output:: "Description": "Run a script" } } + +**To create a document using the YAML document format** + +This example creates a document in your account using the YAML format which targets the EC2 instance type. Note that ``file://`` must be referenced followed by the path of the content file. + +Command:: + + aws ssm create-document --content file://RunShellScript.yaml --name "RunShellScript" --document-type "Command" --document-format YAML --target-type "/AWS::EC2::Instance" \ No newline at end of file diff --git a/awscli/examples/ssm/delete-parameters.rst b/awscli/examples/ssm/delete-parameters.rst index fd2f4b1cb097..42878dcdceac 100644 --- a/awscli/examples/ssm/delete-parameters.rst +++ b/awscli/examples/ssm/delete-parameters.rst @@ -7,6 +7,7 @@ Command:: aws ssm delete-parameters --names "HelloWorld" "GoodbyeWorld" Output:: + { "DeletedParameters": [ "HelloWorld", diff --git a/awscli/examples/ssm/describe-activations.rst b/awscli/examples/ssm/describe-activations.rst index 093dde8243d4..380ad03fddcc 100755 --- a/awscli/examples/ssm/describe-activations.rst +++ b/awscli/examples/ssm/describe-activations.rst @@ -11,14 +11,15 @@ Output:: { "ActivationList": [ { - "IamRole": "AutomationRole", - "RegistrationLimit": 10, "ActivationId": "bcf6faa8-83fd-419e-9534-96ad14131eb7", - "ExpirationDate": 1487887903.045, - "CreatedDate": 1487801503.045, + "Description": "test", "DefaultInstanceName": "MyWebServers", - "Expired": false, + "IamRole": "AutomationRole", + "RegistrationLimit": 10, "RegistrationsCount": 0 + "ExpirationDate": 1550176478.734, + "Expired": false, + "CreatedDate": 1550090078.734 } ] } diff --git a/awscli/examples/ssm/describe-available-patches.rst b/awscli/examples/ssm/describe-available-patches.rst index 2a0cf6725090..8ed18a084f3c 100755 --- a/awscli/examples/ssm/describe-available-patches.rst +++ b/awscli/examples/ssm/describe-available-patches.rst @@ -1,45 +1,75 @@ **To get available patches** -This example gets all available patches for Windows Server 2012 that have a MSRC severity of Critical. +This example gets all available patches for Windows Server 2019 that have a MSRC severity of Critical. Command:: - aws ssm describe-available-patches --filters "Key=PRODUCT,Values=WindowsServer2012" "Key=MSRC_SEVERITY,Values=Critical" + aws ssm describe-available-patches --filters "Key=PRODUCT,Values=WindowsServer2019" "Key=MSRC_SEVERITY,Values=Critical" Output:: { "Patches": [ { - "ContentUrl": "https://support.microsoft.com/en-us/kb/2727528", - "ProductFamily": "Windows", - "Product": "WindowsServer2012", + "Id": "fe6bd8c2-3752-4c8b-ab3e-1a7ed08767ba", + "ReleaseDate": 1544047205.0, + "Title": "2018-11 Update for Windows Server 2019 for x64-based Systems (KB4470788)", + "Description": "Install this update to resolve issues in Windows. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article for more information. After you install this item, you may have to restart your computer.", + "ContentUrl": "https://support.microsoft.com/en-us/kb/4470788", "Vendor": "Microsoft", - "Description": "A security issue has been identified that could allow an unauthenticated remote attacker to compromise your system and gain control over it. You can help protect your system by installing this update from Microsoft. After you install this update, you may have to restart your system.", + "ProductFamily": "Windows", + "Product": "WindowsServer2019", "Classification": "SecurityUpdates", - "Title": "Security Update for Windows Server 2012 (KB2727528)", - "ReleaseDate": 1352829600.0, - "Language": "All", "MsrcSeverity": "Critical", - "KbNumber": "KB2727528", - "MsrcNumber": "MS12-072", - "Id": "1eb507be-2040-4eeb-803d-abc55700b715" + "KbNumber": "KB4470788", + "MsrcNumber": "", + "Language": "All" }, { - "ContentUrl": "https://support.microsoft.com/en-us/kb/2729462", - "ProductFamily": "Windows", - "Product": "WindowsServer2012", + "Id": "c96115e1-5587-4115-b851-22baa46a3f11", + "ReleaseDate": 1549994410.0, + "Title": "2019-02 Security Update for Adobe Flash Player for Windows Server 2019 for x64-based Systems (KB4487038)", + "Description": "A security issue has been identified in a Microsoft software product that could affect your system. You can help protect your system by installing this update from Microsoft. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article. After you install this update, you may have to restart your system.", + "ContentUrl": "https://support.microsoft.com/en-us/kb/4487038", "Vendor": "Microsoft", - "Description": "A security issue has been identified that could allow an unauthenticated remote attacker to compromise your system and gain control over it. You can help protect your system by installing this update from Microsoft. After you install this update, you may have to restart your system.", + "ProductFamily": "Windows", + "Product": "WindowsServer2019", "Classification": "SecurityUpdates", - "Title": "Security Update for Microsoft .NET Framework 3.5 on Windows 8 and Windows Server 2012 for x64-based Systems (KB2729462)", - "ReleaseDate": 1352829600.0, - "Language": "All", "MsrcSeverity": "Critical", - "KbNumber": "KB2729462", - "MsrcNumber": "MS12-074", - "Id": "af873760-c97c-4088-ab7e-5219e120eab4" + "KbNumber": "KB4487038", + "MsrcNumber": "", + "Language": "All" }, - ... - } - } \ No newline at end of file + ... + ] + } + +**To get details of a specific patch** + +This example returns details for the specified patch. + +Command:: + + aws ssm describe-available-patches --filters "Key=PATCH_ID,Values=KB4480979" + +Output:: + + { + "Patches": [ + { + "Id": "680861e3-fb75-432e-818e-d72e5f2be719", + "ReleaseDate": 1546970408.0, + "Title": "2019-01 Security Update for Adobe Flash Player for Windows Server 2016 for x64-based Systems (KB4480979)", + "Description": "A security issue has been identified in a Microsoft software product that could affect your system. You can help protect your system by installing this update from Microsoft. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article. After you install this update, you may have to restart your system.", + "ContentUrl": "https://support.microsoft.com/en-us/kb/4480979", + "Vendor": "Microsoft", + "ProductFamily": "Windows", + "Product": "WindowsServer2016", + "Classification": "SecurityUpdates", + "MsrcSeverity": "Critical", + "KbNumber": "KB4480979", + "MsrcNumber": "", + "Language": "All" + } + ] + } diff --git a/awscli/examples/ssm/describe-effective-patches-for-patch-baseline.rst b/awscli/examples/ssm/describe-effective-patches-for-patch-baseline.rst index b9d277e09fc7..0e3071f1f122 100755 --- a/awscli/examples/ssm/describe-effective-patches-for-patch-baseline.rst +++ b/awscli/examples/ssm/describe-effective-patches-for-patch-baseline.rst @@ -9,33 +9,52 @@ Command:: Output:: { - "NextToken": "--token string truncated--": [ + "EffectivePatches": [ { - "PatchStatus": { - "ApprovalDate": 1292954400.0, - "DeploymentStatus": "APPROVED" - }, "Patch": { - "ContentUrl": "https://support.microsoft.com/en-us/kb/2207559", - "ProductFamily": "Windows", - "Product": "WindowsServer2008R2", + "Id": "fe6bd8c2-3752-4c8b-ab3e-1a7ed08767ba", + "ReleaseDate": 1544047205.0, + "Title": "2018-11 Update for Windows Server 2019 for x64-based Systems (KB4470788)", + "Description": "Install this update to resolve issues in Windows. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article for more information. After you install this item, you may have to restart your computer.", + "ContentUrl": "https://support.microsoft.com/en-us/kb/4470788", "Vendor": "Microsoft", - "Description": "A security issue has been identified that could allow an authenticated remote attacker to cause the affected system to stop responding. You can help protect your system by installing this update from Microsoft. After you install this update, you may have to restart your system.", + "ProductFamily": "Windows", + "Product": "WindowsServer2019", "Classification": "SecurityUpdates", - "Title": "Security Update for Windows Server 2008 R2 x64 Edition (KB2207559)", - "ReleaseDate": 1292349600.0, - "Language": "All", - "MsrcSeverity": "Important", - "KbNumber": "KB2207559", - "MsrcNumber": "MS10-101", - "Id": "79d0c8b2-5b35-4455-bfa3-89e0f08fa980" + "MsrcSeverity": "Critical", + "KbNumber": "KB4470788", + "MsrcNumber": "", + "Language": "All" + }, + "PatchStatus": { + "DeploymentStatus": "APPROVED", + "ComplianceLevel": "CRITICAL", + "ApprovalDate": 1544047205.0 } }, { - "PatchStatus": { - "ApprovalDate": 1285088400.0, - "DeploymentStatus": "APPROVED" + "Patch": { + "Id": "915a6b1a-f556-4d83-8f50-b2e75a9a7e58", + "ReleaseDate": 1549994400.0, + "Title": "2019-02 Cumulative Update for .NET Framework 3.5 and 4.7.2 for Windows Server 2019 for x64 (KB4483452)", + "Description": "A security issue has been identified in a Microsoft software product that could affect your system. You can help protect your system by installing this update from Microsoft. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article. After you install this update, you may have to restart your system.", + "ContentUrl": "https://support.microsoft.com/en-us/kb/4483452", + "Vendor": "Microsoft", + "ProductFamily": "Windows", + "Product": "WindowsServer2019", + "Classification": "SecurityUpdates", + "MsrcSeverity": "Important", + "KbNumber": "KB4483452", + "MsrcNumber": "", + "Language": "All" }, + "PatchStatus": { + "DeploymentStatus": "APPROVED", + "ComplianceLevel": "CRITICAL", + "ApprovalDate": 1549994400.0 + } + }, ... - } - } + ], + "NextToken": "--token string truncated--" +} \ No newline at end of file diff --git a/awscli/examples/ssm/describe-instance-patch-states-for-patch-group.rst b/awscli/examples/ssm/describe-instance-patch-states-for-patch-group.rst index d0fcb611dedd..cedcede744c0 100755 --- a/awscli/examples/ssm/describe-instance-patch-states-for-patch-group.rst +++ b/awscli/examples/ssm/describe-instance-patch-states-for-patch-group.rst @@ -10,34 +10,37 @@ Output:: { "InstancePatchStates": [ - { - "OperationStartTime":1481259600.0, - "FailedCount":0, - "InstanceId":"i-08ee91c0b17045407", - "OwnerInformation":"", - "NotApplicableCount":2077, - "OperationEndTime":1481259757.0, - "PatchGroup":"Production", - "InstalledOtherCount":186, - "MissingCount":7, - "SnapshotId":"b0e65479-79be-4288-9f88-81c96bc3ed5e", - "Operation":"Scan", - "InstalledCount":72 - }, - { - "OperationStartTime":1481259602.0, - "FailedCount":0, - "InstanceId":"i-0fff3aab684d01b23", - "OwnerInformation":"", - "NotApplicableCount":2692, - "OperationEndTime":1481259613.0, - "PatchGroup":"Production", - "InstalledOtherCount":3, - "MissingCount":1, - "SnapshotId":"b0e65479-79be-4288-9f88-81c96bc3ed5e", - "Operation":"Scan", - "InstalledCount":1 - }, - ... - ] + { + "InstanceId": "i-1234567890abcdef0", + "PatchGroup": "Production", + "BaselineId": "pb-0713accee01234567", + "SnapshotId": "521c3536-930c-4aa9-950e-01234567abcd", + "OwnerInformation": "", + "InstalledCount": 1, + "InstalledOtherCount": 13, + "InstalledRejectedCount": 0, + "MissingCount": 3, + "FailedCount": 0, + "NotApplicableCount": 11, + "OperationStartTime": 1550244665.723, + "OperationEndTime": 1550244826.241, + "Operation": "Scan" + }, + { + "InstanceId": "i-0987654321abcdef0", + "PatchGroup": "Production", + "BaselineId": "pb-0713accee01234567", + "SnapshotId": "521c3536-930c-4aa9-950e-01234567abcd", + "OwnerInformation": "", + "InstalledCount": 1, + "InstalledOtherCount": 7, + "InstalledRejectedCount": 0, + "MissingCount": 1, + "FailedCount": 0, + "NotApplicableCount": 13, + "OperationStartTime": 1550245130.069, + "OperationEndTime": 1550245143.043, + "Operation": "Scan" + } + ] } diff --git a/awscli/examples/ssm/describe-instance-patch-states.rst b/awscli/examples/ssm/describe-instance-patch-states.rst index ca5a0e4c9959..40e9733f978e 100755 --- a/awscli/examples/ssm/describe-instance-patch-states.rst +++ b/awscli/examples/ssm/describe-instance-patch-states.rst @@ -4,39 +4,27 @@ This example gets the patch summary states for an instance. Command:: - aws ssm describe-instance-patch-states --instance-ids "i-08ee91c0b17045407" "i-09a618aec652973a9" + aws ssm describe-instance-patch-states --instance-ids "i-1234567890abcdef0" Output:: { "InstancePatchStates": [ - { - "OperationStartTime":"2016-12-09T05:00:00Z", - "FailedCount":0, - "InstanceId":"i-08ee91c0b17045407", - "OwnerInformation":"", - "NotApplicableCount":2077, - "OperationEndTime":"2016-12-09T05:02:37Z", - "PatchGroup":"Production", - "InstalledOtherCount":186, - "MissingCount":7, - "SnapshotId":"b0e65479-79be-4288-9f88-81c96bc3ed5e", - "Operation":"Scan", - "InstalledCount":72 - }, - { - "OperationStartTime":"2016-12-09T04:59:09Z", - "FailedCount":0, - "InstanceId":"i-09a618aec652973a9" - "OwnerInformation":"", - "NotApplicableCount":1637, - "OperationEndTime":"2016-12-09T05:03:57Z", - "PatchGroup":"Production", - "InstalledOtherCount":388, - "MissingCount":2, - "SnapshotId":"b0e65479-79be-4288-9f88-81c96bc3ed5e", - "Operation":"Scan", - "InstalledCount":141 - } - ] + { + "InstanceId": "i-1234567890abcdef0", + "PatchGroup": "", + "BaselineId": "pb-0713accee01234567", + "SnapshotId": "521c3536-930c-4aa9-950e-01234567abcd", + "OwnerInformation": "", + "InstalledCount": 2, + "InstalledOtherCount": 12, + "InstalledRejectedCount": 0, + "MissingCount": 1, + "FailedCount": 0, + "NotApplicableCount": 675, + "OperationStartTime": 1548438382.462, + "OperationEndTime": 1548438392.176, + "Operation": "Scan" + } + ] } diff --git a/awscli/examples/ssm/describe-instance-patches.rst b/awscli/examples/ssm/describe-instance-patches.rst index 7de9967c69d5..d99d6aa7a24c 100755 --- a/awscli/examples/ssm/describe-instance-patches.rst +++ b/awscli/examples/ssm/describe-instance-patches.rst @@ -1,38 +1,57 @@ -**To get the patch compliance details for an instance** +**To get the patch state details for an instance** -This example gets the patch compliance details for an instance. +This example retrieves information about the patch state details for the specified instance. Command:: - aws ssm describe-instance-patches --instance-id "i-08ee91c0b17045407" + aws ssm describe-instance-patches --instance-id "i-1234567890abcdef0" Output:: { - "NextToken":"--token string truncated--", - "Patches":[ - { - "KBId":"KB2919355", - "Severity":"Critical", - "Classification":"SecurityUpdates", - "Title":"Windows 8.1 Update for x64-based Systems (KB2919355)", - "State":"Installed", - "InstalledTime":"2014-03-18T12:00:00Z" - }, - { - "KBId":"KB2977765", - "Severity":"Important", - "Classification":"SecurityUpdates", - "Title":"Security Update for Microsoft .NET Framework 4.5.1 and 4.5.2 on Windows 8.1 and Windows Server 2012 R2 x64-based Systems (KB2977765)", - "State":"Installed", - "InstalledTime":"2014-10-15T12:00:00Z" - }, - { - "KBId":"KB2978126", - "Severity":"Important", - "Classification":"SecurityUpdates", - "Title":"Security Update for Microsoft .NET Framework 4.5.1 and 4.5.2 on Windows 8.1 (KB2978126)", - "State":"Installed", - "InstalledTime":"2014-11-18T12:00:00Z" - }, - ---output truncated--- + "Patches": [ + { + "Title": "2019-01 Security Update for Adobe Flash Player for Windows Server 2016 for x64-based Systems (KB4480979)", + "KBId": "KB4480979", + "Classification": "SecurityUpdates", + "Severity": "Critical", + "State": "Installed", + "InstalledTime": 1546992000.0 + }, + { + "Title": "", + "KBId": "KB4481031", + "Classification": "", + "Severity": "", + "State": "InstalledOther", + "InstalledTime": 1549584000.0 + }, + ... + ], + "NextToken": "--token string truncated--" + } + +**To get a list of patches in the Missing state for an instance** + +This example retrieves information about patches that are in the Missing state for the specified instance. + +Command:: + + aws ssm describe-instance-patches --instance-id "i-1234567890abcdef0" --filters Key=State,Values=Missing + +Output:: + + { + "Patches": [ + { + "Title": "Windows Malicious Software Removal Tool x64 - February 2019 (KB890830)", + "KBId": "KB890830", + "Classification": "UpdateRollups", + "Severity": "Unspecified", + "State": "Missing", + "InstalledTime": 0.0 + }, + ... + ], + "NextToken": "--token string truncated--" + } diff --git a/awscli/examples/ssm/describe-patch-baselines.rst b/awscli/examples/ssm/describe-patch-baselines.rst index 012fc57c0919..0647ecdceb47 100755 --- a/awscli/examples/ssm/describe-patch-baselines.rst +++ b/awscli/examples/ssm/describe-patch-baselines.rst @@ -11,23 +11,20 @@ Output:: { "BaselineIdentities": [ { - "BaselineName": "AWS-DefaultPatchBaseline", - "DefaultBaseline": true, - "BaselineDescription": "Default Patch Baseline Provided by AWS.", - "BaselineId": "arn:aws:ssm:us-west-2:812345678901:patchbaseline/pb-04fb4ae6142167966" + "BaselineId": "arn:aws:ssm:us-east-1:075727635805:patchbaseline/pb-03e3f588eec25344c", + "BaselineName": "AWS-CentOSDefaultPatchBaseline", + "OperatingSystem": "CENTOS", + "BaselineDescription": "Default Patch Baseline for CentOS Provided by AWS.", + "DefaultBaseline": true }, { - "BaselineName": "Production-Baseline", - "DefaultBaseline": false, - "BaselineDescription": "Baseline containing all updates approved for production systems", - "BaselineId": "pb-045f10b4f382baeda" + "BaselineId": "arn:aws:ssm:us-east-1:075727635805:patchbaseline/pb-07d8884178197b66b", + "BaselineName": "AWS-SuseDefaultPatchBaseline", + "OperatingSystem": "SUSE", + "BaselineDescription": "Default Patch Baseline for Suse Provided by AWS.", + "DefaultBaseline": true }, - { - "BaselineName": "Production-Baseline", - "DefaultBaseline": false, - "BaselineDescription": "Baseline containing all updates approved for production systems", - "BaselineId": "pb-0a2f1059b670ebd31" - } + ... ] } diff --git a/awscli/examples/ssm/describe-patch-group-state.rst b/awscli/examples/ssm/describe-patch-group-state.rst index 926cd6656fd7..d765cc2e4887 100755 --- a/awscli/examples/ssm/describe-patch-group-state.rst +++ b/awscli/examples/ssm/describe-patch-group-state.rst @@ -9,10 +9,11 @@ Command:: Output:: { - "InstancesWithNotApplicablePatches": 0, - "InstancesWithMissingPatches": 0, - "InstancesWithFailedPatches": 1, - "InstancesWithInstalledOtherPatches": 4, - "Instances": 4, - "InstancesWithInstalledPatches": 3 + "Instances": 2, + "InstancesWithInstalledPatches": 2, + "InstancesWithInstalledOtherPatches": 2, + "InstancesWithInstalledRejectedPatches": 0, + "InstancesWithMissingPatches": 2, + "InstancesWithFailedPatches": 0, + "InstancesWithNotApplicablePatches": 2 } diff --git a/awscli/examples/ssm/describe-patch-groups.rst b/awscli/examples/ssm/describe-patch-groups.rst index f7e00a08d525..699dc39fb8d2 100755 --- a/awscli/examples/ssm/describe-patch-groups.rst +++ b/awscli/examples/ssm/describe-patch-groups.rst @@ -13,11 +13,23 @@ Output:: { "PatchGroup": "Production", "BaselineIdentity": { - "BaselineName": "Production-Baseline", - "DefaultBaseline": false, - "BaselineDescription": "Baseline containing all updates approved for production systems", - "BaselineId": "pb-045f10b4f382baeda" + "BaselineId": "pb-0123456789abcdef0", + "BaselineName": "ProdPatching", + "OperatingSystem": "WINDOWS", + "BaselineDescription": "Patches for Production", + "DefaultBaseline": false } - } + }, + { + "PatchGroup": "Development", + "BaselineIdentity": { + "BaselineId": "pb-0713accee01234567", + "BaselineName": "DevPatching", + "OperatingSystem": "WINDOWS", + "BaselineDescription": "Patches for Development", + "DefaultBaseline": true + } + }, + ... ] } diff --git a/awscli/examples/ssm/describe-sessions.rst b/awscli/examples/ssm/describe-sessions.rst new file mode 100644 index 000000000000..788441f5c2e1 --- /dev/null +++ b/awscli/examples/ssm/describe-sessions.rst @@ -0,0 +1,64 @@ +**To list all active Session Manager sessions** + +This example retrieves a list of the active sessions created most recently (both connected and disconnected sessions) over the past 30 days that were started by a particular user. + +Command:: + + aws ssm describe-sessions --state "Active" --filters "key=Owner,value=arn:aws:sts::123456789012:assumed-role/Administrator/Matt" + +Output:: + + { + "Sessions": [ + { + "SessionId": "Matt-07a16060613c408b5", + "Target": "i-1234567890abcdef0", + "Status": "Connected", + "StartDate": 1550676938.352, + "Owner": "arn:aws:sts::123456789012:assumed-role/Administrator/Matt", + "OutputUrl": {} + }, + { + "SessionId": "Matt-01edf534b8b56e8eb", + "Target": "i-9876543210abcdef0", + "Status": "Connected", + "StartDate": 1550676842.194, + "Owner": "arn:aws:sts::123456789012:assumed-role/Administrator/Matt", + "OutputUrl": {} + } + ] + } + +**To list all terminated Session Manager sessions** + +This example retrieves a list of the most recently terminated sessions from the past 30 days for all users. + +Command:: + + aws ssm describe-sessions --state "History" + +Output:: + + { + "Sessions": [ + { + "SessionId": "Dan-0022b1eb2b0d9e3bd", + "Target": "i-1234567890abcdef0", + "Status": "Terminated", + "StartDate": 1550520701.256, + "EndDate": 1550521931.563, + "Owner": "arn:aws:sts::123456789012:assumed-role/Administrator/Dan" + }, + { + "SessionId": "Erik-0db53f487931ed9d4", + "Target": "i-9876543210abcdef0", + "Status": "Terminated", + "StartDate": 1550161369.149, + "EndDate": 1550162580.329, + "Owner": "arn:aws:sts::123456789012:assumed-role/Administrator/Erik" + }, + ... + ], + "NextToken": "--token string truncated--" + } + \ No newline at end of file diff --git a/awscli/examples/ssm/get-command-invocation.rst b/awscli/examples/ssm/get-command-invocation.rst index 8628cef947af..fb92bff428a2 100755 --- a/awscli/examples/ssm/get-command-invocation.rst +++ b/awscli/examples/ssm/get-command-invocation.rst @@ -4,21 +4,28 @@ This example lists all the invocations of a command on an instance. Command:: - aws ssm get-command-invocation --command-id "bca3371c-3fdf-43f1-9323-7a7780b1b4db" --instance-id "i-0000293ffd8c57862" + aws ssm get-command-invocation --command-id "ef7fdfd8-9b57-4151-a15c-db9a12345678" --instance-id "i-1234567890abcdef0" Output:: { - "Comment": "Apply association with id at creation time: a052fd99-0852-4df2-ad69-0299f2c82047", - "Status": "SUCCESS", - "ExecutionEndDateTime": "", - "StandardErrorContent": "", - "InstanceId": "i-0000293ffd8c57862", - "StandardErrorUrl": "", - "DocumentName": "AWS-RefreshAssociation", - "StandardOutputContent": "", - "PluginName": "", - "ResponseCode": -1, - "CommandId": "bca3371c-3fdf-43f1-9323-7a7780b1b4db", - "StandardOutputUrl": "" + "CommandId": "ef7fdfd8-9b57-4151-a15c-db9a12345678", + "InstanceId": "i-1234567890abcdef0", + "Comment": "", + "DocumentName": "AWS-RunPowerShellScript", + "DocumentVersion": "1", + "PluginName": "aws:runPowerShellScript", + "ResponseCode": 0, + "ExecutionStartDateTime": "2019-02-14T19:26:26.439Z", + "ExecutionElapsedTime": "PT0.541S", + "ExecutionEndDateTime": "2019-02-14T19:26:26.439Z", + "Status": "Success", + "StatusDetails": "Success", + "StandardOutputContent": "HelloWorld\r\n", + "StandardOutputUrl": "", + "StandardErrorContent": "", + "StandardErrorUrl": "", + "CloudWatchOutputConfig": { + "CloudWatchLogGroupName": "", + "CloudWatchOutputEnabled": false } diff --git a/awscli/examples/ssm/get-default-patch-baseline.rst b/awscli/examples/ssm/get-default-patch-baseline.rst index 640b902b8926..cf6ccd687bc5 100755 --- a/awscli/examples/ssm/get-default-patch-baseline.rst +++ b/awscli/examples/ssm/get-default-patch-baseline.rst @@ -1,6 +1,6 @@ -**To display the default patch baseline** +**To display the default Windows patch baseline** -This example displays the default patch baseline. +This example displays the default Windows patch baseline. Command:: @@ -9,5 +9,21 @@ Command:: Output:: { - "BaselineId":"arn:aws:ssm:us-west-1:812345678901:patchbaseline/pb-0ca44a362f8afc725" + "BaselineId": "pb-0713accee01612345", + "OperatingSystem": "WINDOWS" + } + +**To display the default Amazon Linux patch baseline** + +This example displays the default Windows patch baseline. + +Command:: + + aws ssm get-default-patch-baseline --operating-system AMAZON_LINUX + +Output:: + + { + "BaselineId": "pb-047c6eb9c8fc12345", + "OperatingSystem": "AMAZON_LINUX" } diff --git a/awscli/examples/ssm/get-deployable-patch-snapshot-for-instance.rst b/awscli/examples/ssm/get-deployable-patch-snapshot-for-instance.rst index 398436754de1..91808f7f9fbf 100755 --- a/awscli/examples/ssm/get-deployable-patch-snapshot-for-instance.rst +++ b/awscli/examples/ssm/get-deployable-patch-snapshot-for-instance.rst @@ -6,12 +6,13 @@ Use ``uuidgen`` to generate a ``snapshot-id``. Command:: - aws ssm get-deployable-patch-snapshot-for-instance --instance-id "i-0cb2b964d3e14fd9f" --snapshot-id "4681775b-098f-4435-a956-0ef33373ac11" + aws ssm get-deployable-patch-snapshot-for-instance --instance-id "i-1234567890abcdef0" --snapshot-id "521c3536-930c-4aa9-950e-01234567abcd" Output:: { - "InstanceId": "i-0cb2b964d3e14fd9f", - "SnapshotId": "4681775b-098f-4435-a956-0ef33373ac11", - "SnapshotDownloadUrl": "https://patch-baseline-snapshot-us-west-2.s3-us-west-2.amazonaws.com/853d0d3db0f0cafea3699f25b1c7ff101a13e25c3d05e832f613b0d2f79da62f-809632081692/4681775b-098f-4435-a956-0ef33373ac11?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20170224T181926Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86400&X-Amz-Credential=AKIAJI6YDVV7XJKZL7ZA%2F20170224%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Signature=2747799c958ffebf6f44bd698fd2071ccf9a303465febfab71ff29b46631a2d3" + "InstanceId": "i-1234567890abcdef0", + "SnapshotId": "521c3536-930c-4aa9-950e-01234567abcd", + "Product": "AmazonLinux2018.03", + "SnapshotDownloadUrl": "https://patch-baseline-snapshot-us-east-1.s3.amazonaws.com/ed85194ef27214f5984f28b4d664d14f7313568fea7d4b6ac6c10ad1f729d7e7-773304212436/AMAZON_LINUX-521c3536-930c-4aa9-950e-01234567abcd?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20190215T164031Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86400&X-Amz-Credential=AKIAJ5C56P35AEBRX2QQ%2F20190215%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=efaaaf6e3878e77f48a6697e015efdbda9c426b09c5822055075c062f6ad2149" } diff --git a/awscli/examples/ssm/get-document.rst b/awscli/examples/ssm/get-document.rst index 5967e9342359..0622fff5f5cb 100644 --- a/awscli/examples/ssm/get-document.rst +++ b/awscli/examples/ssm/get-document.rst @@ -14,3 +14,22 @@ Output:: "DocumentVersion": "1", "DocumentType": "Command" } + +**To get the contents of a document in YAML format** + +This example returns the content of a document in YAML format. + +Command:: + + aws ssm get-document --name "RunShellScript" --document-format YAML + +Output:: + + { + "Name": "A-Document-yaml2", + "DocumentVersion": "1", + "Status": "Active", + "Content": "---\nschemaVersion: '1.2'\ndescription: Run a PowerShell script or specify the paths to scripts to run.\nparameters:\n commands:\n type: StringList\n description: \"(Required) Specify the commands to run or the paths to existing\n scripts on the instance.\"\n minItems: 1\n displayType: textarea\n workingDirectory:\n type: String\n default: ''\n description: \"(Optional) The path to the working directory on your instance.\"\n maxChars: 4096\n executionTimeout:\n type: String\n default: '3600'\n description: \"(Optional) The time in seconds for a command to be completed before\n it is considered to have failed. Default is 3600 (1 hour). Maximum is 172800\n (48 hours).\"\n allowedPattern: \"([1-9][0-9]{0,4})|(1[0-6][0-9]{4})|(17[0-1][0-9]{3})|(172[0-7][0-9]{2})|(172800)\"\nruntimeConfig:\n aws:runPowerShellScript:\n properties:\n - id: 0.aws:runPowerShellScript\n runCommand: \"{{ commands }}\"\n workingDirectory: \"{{ workingDirectory }}\"\n timeoutSeconds: \"{{ executionTimeout }}\"\n", + "DocumentType": "Command", + "DocumentFormat": "YAML" + } \ No newline at end of file diff --git a/awscli/examples/ssm/get-patch-baseline-for-patch-group.rst b/awscli/examples/ssm/get-patch-baseline-for-patch-group.rst index 9c13f545a443..fa6fadf2c8bf 100755 --- a/awscli/examples/ssm/get-patch-baseline-for-patch-group.rst +++ b/awscli/examples/ssm/get-patch-baseline-for-patch-group.rst @@ -4,11 +4,12 @@ This example displays the patch baseline for a patch group. Command:: - aws ssm get-patch-baseline-for-patch-group --patch-group "Production" + aws ssm get-patch-baseline-for-patch-group --patch-group "DEV" Output:: { - "PatchGroup": "Production", - "BaselineId": "pb-045f10b4f382baeda" + "BaselineId": "pb-0123456789abcdef0", + "PatchGroup": "DEV", + "OperatingSystem": "WINDOWS" } diff --git a/awscli/examples/ssm/get-patch-baseline.rst b/awscli/examples/ssm/get-patch-baseline.rst index 9683b4bac359..68b612232eb7 100755 --- a/awscli/examples/ssm/get-patch-baseline.rst +++ b/awscli/examples/ssm/get-patch-baseline.rst @@ -4,58 +4,47 @@ This example displays the details for a patch baseline. Command:: - aws ssm get-patch-baseline --baseline-id "pb-00dbb759999aa2bc3" + aws ssm get-patch-baseline --baseline-id "pb-0123456789abcdef0" Output:: { - "BaselineId":"pb-00dbb759999aa2bc3", - "Name":"Windows-Server-2012R2", - "PatchGroups":[ - "Web Servers" - ], - "RejectedPatches":[ - - ], - "GlobalFilters":{ - "PatchFilters":[ - - ] - }, - "ApprovalRules":{ - "PatchRules":[ - { - "PatchFilterGroup":{ - "PatchFilters":[ - { - "Values":[ - "Important", - "Critical" - ], - "Key":"MSRC_SEVERITY" - }, - { - "Values":[ - "SecurityUpdates" - ], - "Key":"CLASSIFICATION" - }, - { - "Values":[ - "WindowsServer2012R2" - ], - "Key":"PRODUCT" - } - ] - }, - "ApproveAfterDays":5 - } - ] - }, - "ModifiedDate":1480997823.81, - "CreatedDate":1480997823.81, - "ApprovedPatches":[ - - ], - "Description":"Windows Server 2012 R2, Important and Critical security updates" + "BaselineId": "pb-0123456789abcdef0", + "Name": "WindowsPatching", + "OperatingSystem": "WINDOWS", + "GlobalFilters": { + "PatchFilters": [] + }, + "ApprovalRules": { + "PatchRules": [ + { + "PatchFilterGroup": { + "PatchFilters": [ + { + "Key": "PRODUCT", + "Values": [ + "WindowsServer2016" + ] + } + ] + }, + "ComplianceLevel": "CRITICAL", + "ApproveAfterDays": 0, + "EnableNonSecurity": false + } + ] + }, + "ApprovedPatches": [], + "ApprovedPatchesComplianceLevel": "UNSPECIFIED", + "ApprovedPatchesEnableNonSecurity": false, + "RejectedPatches": [], + "RejectedPatchesAction": "ALLOW_AS_DEPENDENCY", + "PatchGroups": [ + "QA", + "DEV" + ], + "CreatedDate": 1550244180.465, + "ModifiedDate": 1550244180.465, + "Description": "Patches for Windows Servers", + "Sources": [] } diff --git a/awscli/examples/ssm/get-service-setting.rst b/awscli/examples/ssm/get-service-setting.rst new file mode 100644 index 000000000000..86f88a197f7e --- /dev/null +++ b/awscli/examples/ssm/get-service-setting.rst @@ -0,0 +1,22 @@ +**To retrieve the service setting for managed instance activation** + +This example retrieves the current service setting tier for managed instance activations in the specified region. For more information, see `Using the Advanced-Instances Tier`_ in the *AWS Systems Manager User Guide*. + +.. _`Using the Advanced-Instances Tier`: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-managedinstances-advanced.html + +Command:: + + aws ssm get-service-setting --setting-id arn:aws:ssm:us-east-1:123456789012:servicesetting/ssm/managed-instance/activation-tier + +Output:: + + { + "ServiceSetting": { + "SettingId": "/ssm/managed-instance/activation-tier", + "SettingValue": "standard", + "LastModifiedDate": 1550708144.058, + "LastModifiedUser": "System", + "ARN": "arn:aws:ssm:us-east-1:123456789012:servicesetting/ssm/managed-instance/activation-tier", + "Status": "Default" + } + } diff --git a/awscli/examples/ssm/list-command-invocations.rst b/awscli/examples/ssm/list-command-invocations.rst index 922f38e9d563..8cbc3c831632 100755 --- a/awscli/examples/ssm/list-command-invocations.rst +++ b/awscli/examples/ssm/list-command-invocations.rst @@ -4,45 +4,89 @@ This example lists all the invocations of a command. Command:: - aws ssm list-command-invocations --command-id "b8eac879-0541-439d-94ec-47a80d554f44" --details + aws ssm list-command-invocations --command-id "ef7fdfd8-9b57-4151-a15c-db9a12345678" --details Output:: { "CommandInvocations": [ - { - "Comment": "IP config", - "Status": "Success", - "CommandPlugins": [ - { - "Status": "Success", - "ResponseStartDateTime": 1487794396.651, - "StandardErrorUrl": "", - "OutputS3BucketName": "", - "OutputS3Region": "us-west-2", - "OutputS3KeyPrefix": "", - "ResponseCode": 0, - "Output": "eth0 Link encap:Ethernet HWaddr 06:41:38:F5:D6:EF \n inet addr:172.31.44.222 Bcast:172.31.47.255 Mask:255.255.240.0\n inet6 addr: fe80::441:38ff:fef5:d6ef/64 Scope:Link\n UP BROADCAST RUNNING MULTICAST MTU:9001 Metric:1\n RX packets:186705 errors:0 dropped:0 overruns:0 frame:0\n TX packets:188811 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:1000 \n RX bytes:91749280 (87.4 MiB) TX bytes:31721645 (30.2 MiB)\n\nlo Link encap:Local Loopback \n inet addr:127.0.0.1 Mask:255.0.0.0\n inet6 addr: ::1/128 Scope:Host\n UP LOOPBACK RUNNING MTU:65536 Metric:1\n RX packets:2 errors:0 dropped:0 overruns:0 frame:0\n X packets:2 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:1 \n RX bytes:140 (140.0 b) TX bytes:140 (140.0 b)\n\n", - "ResponseFinishDateTime": 1487794396.655, - "StatusDetails": "Success", - "StandardOutputUrl": "", - "Name": "aws:runShellScript" - } - ], - "ServiceRole": "", - "InstanceId": "i-0cb2b964d3e14fd9f", - "DocumentName": "AWS-RunShellScript", - "NotificationConfig": { - "NotificationArn": "", - "NotificationEvents": [], - "NotificationType": "" - }, - "StatusDetails": "Success", - "StandardOutputUrl": "", - "StandardErrorUrl": "", - "InstanceName": "", - "CommandId": "b8eac879-0541-439d-94ec-47a80d554f44", - "RequestedDateTime": 1487794396.363 - } - ] + { + "CommandId": "ef7fdfd8-9b57-4151-a15c-db9a12345678", + "InstanceId": "i-1234567890abcdef0", + "InstanceName": "", + "Comment": "", + "DocumentName": "AWS-RunPowerShellScript", + "DocumentVersion": "1", + "RequestedDateTime": 1550172741.988, + "Status": "Success", + "StatusDetails": "Success", + "StandardOutputUrl": "", + "StandardErrorUrl": "", + "CommandPlugins": [ + { + "Name": "aws:runPowerShellScript", + "Status": "Success", + "StatusDetails": "Success", + "ResponseCode": 0, + "ResponseStartDateTime": 1550172742.696, + "ResponseFinishDateTime": 1550172743.245, + "Output": "HelloWorld\r\n", + "StandardOutputUrl": "", + "StandardErrorUrl": "", + "OutputS3Region": "us-east-1", + "OutputS3BucketName": "", + "OutputS3KeyPrefix": "" + } + ], + "ServiceRole": "", + "NotificationConfig": { + "NotificationArn": "", + "NotificationEvents": [], + "NotificationType": "" + }, + "CloudWatchOutputConfig": { + "CloudWatchLogGroupName": "", + "CloudWatchOutputEnabled": false + } + }, + { + "CommandId": "ef7fdfd8-9b57-4151-a15c-db9a12345678", + "InstanceId": "i-12345abcdef678901", + "InstanceName": "", + "Comment": "", + "DocumentName": "AWS-RunPowerShellScript", + "DocumentVersion": "1", + "RequestedDateTime": 1550172741.906, + "Status": "Success", + "StatusDetails": "Success", + "StandardOutputUrl": "", + "StandardErrorUrl": "", + "CommandPlugins": [ + { + "Name": "aws:runPowerShellScript", + "Status": "Success", + "StatusDetails": "Success", + "ResponseCode": 0, + "ResponseStartDateTime": 1550172742.291, + "ResponseFinishDateTime": 1550172742.694, + "Output": "HelloWorld\r\n", + "StandardOutputUrl": "", + "StandardErrorUrl": "", + "OutputS3Region": "us-east-1", + "OutputS3BucketName": "", + "OutputS3KeyPrefix": "" + } + ], + "ServiceRole": "", + "NotificationConfig": { + "NotificationArn": "", + "NotificationEvents": [], + "NotificationType": "" + }, + "CloudWatchOutputConfig": { + "CloudWatchLogGroupName": "", + "CloudWatchOutputEnabled": false + } + } + ] } diff --git a/awscli/examples/ssm/list-commands.rst b/awscli/examples/ssm/list-commands.rst index 257e46a47ab8..3a30195e0e40 100755 --- a/awscli/examples/ssm/list-commands.rst +++ b/awscli/examples/ssm/list-commands.rst @@ -53,3 +53,11 @@ This example gets the status of a command. Command:: aws ssm list-commands --command-id "0831e1a8-a1ac-4257-a1fd-c831b48c4107" + +**To get the status of commands requested after a specific date** + +This example returns the details of commands requested after the specified date. + +Command:: + + aws ssm list-commands --filter "key=InvokedAfter,value=2019-02-01T00:00:00Z" \ No newline at end of file diff --git a/awscli/examples/ssm/list-documents.rst b/awscli/examples/ssm/list-documents.rst index 243b9ac0325a..604a6ac1a82a 100644 --- a/awscli/examples/ssm/list-documents.rst +++ b/awscli/examples/ssm/list-documents.rst @@ -34,3 +34,40 @@ Output:: ... ] } + +**To list all Command configuration documents in your account that you own** + +This example lists all Command documents in your account that you own. + +Command:: + + aws ssm list-documents --document-filter-list key=Owner,value=Self key=DocumentType,value=Command + +Output:: + + { + "DocumentIdentifiers": [ + { + "Name": "RunPowerShellScript", + "PlatformTypes": [ + "Windows", + "Linux" + ], + "DocumentVersion": "1", + "DocumentType": "Command", + "Owner": "111222333444", + "SchemaVersion": "2.0" + }, + { + "Name": "RunShellScript", + "PlatformTypes": [ + "Linux" + ], + "DocumentVersion": "1", + "DocumentType": "Command", + "Owner": "111222333444", + "SchemaVersion": "1.2" + }, + ... + ] + } \ No newline at end of file diff --git a/awscli/examples/ssm/put-parameter.rst b/awscli/examples/ssm/put-parameter.rst index 310e6e8b6405..b47152a9baf8 100755 --- a/awscli/examples/ssm/put-parameter.rst +++ b/awscli/examples/ssm/put-parameter.rst @@ -7,6 +7,7 @@ Command:: aws ssm put-parameter --name "welcome" --type "String" --value "helloWorld" Output:: + { "Version": 1 } @@ -28,6 +29,7 @@ Command:: aws ssm put-parameter --name "NumbersOnly" --type "String" --value "10" --allowed-pattern "^\d+$" Output:: + { "Version": 1 } @@ -41,6 +43,7 @@ Command:: aws ssm put-parameter --name "welcome" --type "String" --value "good day sunshine" --overwrite Output:: + { "Version": 2 } diff --git a/awscli/examples/ssm/register-patch-baseline-for-patch-group.rst b/awscli/examples/ssm/register-patch-baseline-for-patch-group.rst index 30b9f5cc43a4..b13218e9c525 100755 --- a/awscli/examples/ssm/register-patch-baseline-for-patch-group.rst +++ b/awscli/examples/ssm/register-patch-baseline-for-patch-group.rst @@ -9,6 +9,6 @@ Command:: Output:: { - "PatchGroup": "Production", - "BaselineId": "pb-045f10b4f382baeda" + "BaselineId": "pb-045f10b4f382baeda", + "PatchGroup": "Production" } diff --git a/awscli/examples/ssm/resume-session.rst b/awscli/examples/ssm/resume-session.rst new file mode 100644 index 000000000000..7faa004279ac --- /dev/null +++ b/awscli/examples/ssm/resume-session.rst @@ -0,0 +1,20 @@ +**To resume a Session Manager session** + +This example resumes a Session Manager session with an instance after it has been disconnected. + +Note that this interactive command requires the Session Manager plugin to be installed on the client machine making the call. For more information, see `Install the Session Manager Plugin for the AWS CLI`_ in the *AWS Systems Manager User Guide*. + +.. _`Install the Session Manager Plugin for the AWS CLI`: http://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html + +Command:: + + aws ssm resume-session -session-id Dan-07a16060613c408b5 + +Output:: + + { + "SessionId": "Dan-07a16060613c408b5", + "TokenValue": "AAEAAVbTGsaOnyvcUoNGqifbv5r/8lgxuQljCuY8qVcvOnoBAAAAAFxtd3jIXAFUUXGTJ7zF/AWJPwDviOlF5p3dlAgrqVIVO6IEXhkHLz0/1gXKRKEME71E6TLOplLDJAMZ+kREejkZu4c5AxMkrQjMF+gtHP1bYJKTwtHQd1wjulPLexO8SHl7g5R/wekrj6WsDUpnEegFBfGftpAIz2GXQVfTJXKfkc5qepQ11C11DOIT2dozOqXgHwfQHfAKLErM5dWDZqKwyT1Z3iw7unQdm3p5qsbrugiOZ7CRANTE+ihfGa6MEJJ97Jmat/a2TspEnOjNn9Mvu5iwXIW2yCvWZrGUj+/QI5Xr7s1XJBEnSKR54o4fN0GV9RWl0RZsZm1m1ki0JJtiwwgZ", + "StreamUrl": "wss://ssmmessages.us-east-1.amazonaws.com/v1/data-channel/Dan-07a16060613c408b5?role=publish_subscribe" + } + diff --git a/awscli/examples/ssm/send-command.rst b/awscli/examples/ssm/send-command.rst index 6048d969251a..b3dde5729576 100755 --- a/awscli/examples/ssm/send-command.rst +++ b/awscli/examples/ssm/send-command.rst @@ -4,48 +4,49 @@ This example runs an echo command on a target instance. Command:: - aws ssm send-command --document-name "AWS-RunPowerShellScript" --parameters commands=["echo helloWorld"] --targets "Key=instanceids,Values=i-0cb2b964d3e14fd9f" + aws ssm send-command --document-name "AWS-RunShellScript" --parameters commands=["echo HelloWorld"] --targets "Key=instanceids,Values=i-1234567890abcdef0" --comment "echo HelloWorld" Output:: { - "Command": { - "Comment": "", - "Status": "Pending", - "MaxErrors": "0", - "Parameters": { - "commands": [ - "echo helloWorld" - ] - }, - "ExpiresAfter": 1487888845.833, - "ServiceRole": "", - "DocumentName": "AWS-RunPowerShellScript", - "TargetCount": 0, - "OutputS3BucketName": "", - "NotificationConfig": { - "NotificationArn": "", - "NotificationEvents": [], - "NotificationType": "" - }, - "CompletedCount": 0, - "Targets": [ - { - "Values": [ - "i-0cb2b964d3e14fd9f" - ], - "Key": "instanceids" - } - ], - "StatusDetails": "Pending", - "ErrorCount": 0, - "OutputS3KeyPrefix": "", - "RequestedDateTime": 1487885245.833, - "CommandId": "0d4fc863-2154-4e46-990e-d6a952469e91", - "InstanceIds": [], - "MaxConcurrency": "50" - } + "Command": { + "CommandId": "92853adf-ba41-4cd6-9a88-142d119c083d", + "DocumentName": "AWS-RunShellScript", + "DocumentVersion": "", + "Comment": "echo HelloWorld", + "ExpiresAfter": 1550181014.717, + "Parameters": { + "commands": [ + "echo HelloWorld" + ] + }, + "InstanceIds": [ + "i-0f00f008a2dcbefe2" + ], + "Targets": [], + "RequestedDateTime": 1550173814.717, + "Status": "Pending", + "StatusDetails": "Pending", + "OutputS3BucketName": "", + "OutputS3KeyPrefix": "", + "MaxConcurrency": "50", + "MaxErrors": "0", + "TargetCount": 1, + "CompletedCount": 0, + "ErrorCount": 0, + "DeliveryTimedOutCount": 0, + "ServiceRole": "", + "NotificationConfig": { + "NotificationArn": "", + "NotificationEvents": [], + "NotificationType": "" + }, + "CloudWatchOutputConfig": { + "CloudWatchLogGroupName": "", + "CloudWatchOutputEnabled": false + } } +} **To get IP information about an instance** @@ -53,4 +54,45 @@ This example gets the IP information about an instance. Command:: - aws ssm send-command --instance-ids "i-0cb2b964d3e14fd9f" --document-name "AWS-RunShellScript" --comment "IP config" --parameters "commands=ifconfig" --output text + aws ssm send-command --instance-ids "i-1234567890abcdef0" --document-name "AWS-RunShellScript" --comment "IP config" --parameters "commands=ifconfig" + +**To execute a command on instances using tags** + +This example executes a command that targets instances using the tag key "ENV" and the value "Dev". + +Command:: + + aws ssm send-command --targets "Key=tag:ENV,Values=Dev" --document-name "AWS-RunShellScript" --parameters "commands=ifconfig" + +**To execute a command that sends SNS Notifications** + +This example executes a command that is configured to send SNS notifications for all notification events and the Command notification type. + +Command:: + + aws ssm send-command --instance-ids "i-1234567890abcdef0" --document-name "AWS-RunShellScript" --comment "IP config" --parameters "commands=ifconfig" --service-role-arn "arn:aws:iam::123456789012:role/SNS_Role" --notification-config "NotificationArn=arn:aws:sns:us-east-1:123456789012:SNSTopicName,NotificationEvents=All,NotificationType=Command" + +**To execute a command that outputs to S3 and CloudWatch** + +This example executes a command that is configured to output command details to an S3 bucket and to a CloudWatch Logs Group. + +Command:: + + aws ssm send-command --instance-ids "i-1234567890abcdef0" --document-name "AWS-RunShellScript" --comment "IP config" --parameters "commands=ifconfig" --output-s3-bucket-name "s3-bucket-name" --output-s3-key-prefix "runcommand" --cloud-watch-output-config "CloudWatchOutputEnabled=true,CloudWatchLogGroupName=CWLGroupName" + +**To target multiple instances with different tags** + +This example targets two different tag keys and values. + +Command:: + + aws ssm send-command --document-name "AWS-RunPowerShellScript" --parameters commands=["echo helloWorld"] --targets Key=tag:Env,Values=Dev Key=tag:Role,Values=WebServers + +**To target multiple instances with the same tag key** + +This example targets the same tag key with different values. + +Command:: + + aws ssm send-command --document-name "AWS-RunPowerShellScript" --parameters commands=["echo helloWorld"] --targets Key=tag:Env,Values=Dev,Test + diff --git a/awscli/examples/ssm/start-session.rst b/awscli/examples/ssm/start-session.rst new file mode 100644 index 000000000000..a60fc8894af5 --- /dev/null +++ b/awscli/examples/ssm/start-session.rst @@ -0,0 +1,16 @@ +**To start a Session Manager session** + +This example establishes a connection with an instance for a Session Manager session. + +Note that this interactive command requires the Session Manager plugin to be installed on the client machine making the call. For more information, see `Install the Session Manager Plugin for the AWS CLI`_ in the *AWS Systems Manager User Guide*. + +.. _`Install the Session Manager Plugin for the AWS CLI`: http://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html + +Command:: + + aws ssm start-session --target "i-1234567890abcdef0" + +Output:: + + Starting session with SessionId: Erik-07a16060613c408b5 + diff --git a/awscli/examples/ssm/terminate-session.rst b/awscli/examples/ssm/terminate-session.rst new file mode 100644 index 000000000000..842bca16bfe7 --- /dev/null +++ b/awscli/examples/ssm/terminate-session.rst @@ -0,0 +1,13 @@ +**To end a Session Manager session** + +This example permanently ends a session that was created by the user "Bob" and closes the data connection between the Session Manager client and SSM Agent on the instance. + +Command:: + + aws ssm terminate-session --session-id "Bob-07a16060613c408b5" + +Output:: + + { + "SessionId": "Bob-07a16060613c408b5" + } diff --git a/awscli/examples/ssm/update-patch-baseline.rst b/awscli/examples/ssm/update-patch-baseline.rst index 2f1673fc6c94..b8377086145d 100755 --- a/awscli/examples/ssm/update-patch-baseline.rst +++ b/awscli/examples/ssm/update-patch-baseline.rst @@ -4,17 +4,14 @@ This example adds two patches as rejected and one patch as approved to a patch b Command:: - aws ssm update-patch-baseline --baseline-id "pb-045f10b4f382baeda" --rejected-patches "KB2032276" "MS10-048" --approved-patches "KB2124261" + aws ssm update-patch-baseline --baseline-id "pb-0123456789abcdef0" --rejected-patches "KB2032276" "MS10-048" --approved-patches "KB2124261" Output:: { - "BaselineId": "pb-045f10b4f382baeda", - "Name": "Production-Baseline", - "RejectedPatches": [ - "KB2032276", - "MS10-048" - ], + "BaselineId": "pb-0123456789abcdef0", + "Name": "WindowsPatching", + "OperatingSystem": "WINDOWS", "GlobalFilters": { "PatchFilters": [] }, @@ -24,34 +21,33 @@ Output:: "PatchFilterGroup": { "PatchFilters": [ { + "Key": "PRODUCT", "Values": [ - "Critical", - "Important", - "Moderate" - ], - "Key": "MSRC_SEVERITY" - }, - { - "Values": [ - "SecurityUpdates", - "Updates", - "UpdateRollups", - "CriticalUpdates" - ], - "Key": "CLASSIFICATION" + "WindowsServer2016" + ] } ] }, - "ApproveAfterDays": 7 + "ComplianceLevel": "CRITICAL", + "ApproveAfterDays": 0, + "EnableNonSecurity": false } ] }, - "ModifiedDate": 1487872602.453, - "CreatedDate": 1487870482.16, "ApprovedPatches": [ "KB2124261" ], - "Description": "Baseline containing all updates approved for production systems" + "ApprovedPatchesComplianceLevel": "UNSPECIFIED", + "ApprovedPatchesEnableNonSecurity": false, + "RejectedPatches": [ + "KB2032276", + "MS10-048" + ], + "RejectedPatchesAction": "ALLOW_AS_DEPENDENCY", + "CreatedDate": 1550244180.465, + "ModifiedDate": 1550244180.465, + "Description": "Patches for Windows Servers", + "Sources": [] } **To rename a patch baseline** @@ -60,5 +56,5 @@ This example renames a patch baseline. Command:: - aws ssm update-patch-baseline --baseline-id "pb-00dbb759999aa2bc3" --name "Windows-Server-2012-R2-Important-and-Critical-Security-Updates" + aws ssm update-patch-baseline --baseline-id "pb-0713accee01234567" --name "Windows-Server-2012-R2-Important-and-Critical-Security-Updates" \ No newline at end of file diff --git a/awscli/examples/ssm/update-service-setting.rst b/awscli/examples/ssm/update-service-setting.rst new file mode 100644 index 000000000000..efe252f47b1d --- /dev/null +++ b/awscli/examples/ssm/update-service-setting.rst @@ -0,0 +1,10 @@ +**To update the service setting for managed instance activation** + +This example updates the current service setting tier for managed instance activations in the specified region to use advanced instances. There is no output if the command succeeds. For more information, see `Using the Advanced-Instances Tier`_ in the *AWS Systems Manager User Guide*. + +.. _`Using the Advanced-Instances Tier`: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-managedinstances-advanced.html + +Command:: + + aws ssm update-service-setting --setting-id arn:aws:ssm:us-east-1:123456789012:servicesetting/ssm/managed-instance/activation-tier --setting-value advanced + diff --git a/awscli/formatter.py b/awscli/formatter.py index 886017b23ce0..f163f3adba9e 100644 --- a/awscli/formatter.py +++ b/awscli/formatter.py @@ -231,8 +231,12 @@ def __call__(self, command_name, response, stream=None): try: if is_response_paginated(response): result_keys = response.result_keys - for page in response: - current = {} + for i, page in enumerate(response): + if i > 0: + current = {} + else: + current = response.non_aggregate_part + for result_key in result_keys: data = result_key.search(page) set_value_from_jmespath( diff --git a/doc/source/conf.py b/doc/source/conf.py index 096baa2b9e4f..0dc74fff374b 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -52,7 +52,7 @@ # The short X.Y version. version = '1.16.1' # The full version, including alpha/beta/rc tags. -release = '1.16.141' +release = '1.16.160' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.cfg b/setup.cfg index 41aaa96171bb..2c0cbdfa0e26 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,7 +4,7 @@ universal = 1 [metadata] requires-dist = - botocore==1.12.131 + botocore==1.12.150 colorama>=0.2.5,<=0.3.9 docutils>=0.10 rsa>=3.1.2,<=3.5.0 diff --git a/setup.py b/setup.py index 586640c5378f..a2dc1c6d7dd3 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ def find_version(*file_paths): raise RuntimeError("Unable to find version string.") -requires = ['botocore==1.12.131', +requires = ['botocore==1.12.150', 'colorama>=0.2.5,<=0.3.9', 'docutils>=0.10', 'rsa>=3.1.2,<=3.5.0', diff --git a/tests/functional/cloudformation/test_package.py b/tests/functional/cloudformation/test_package.py index fb43790e54a5..097bc81310a2 100644 --- a/tests/functional/cloudformation/test_package.py +++ b/tests/functional/cloudformation/test_package.py @@ -19,6 +19,7 @@ from unittest import TestCase from awscli.customizations.cloudformation.artifact_exporter import make_zip +from awscli.testutils import skip_if_windows class TestPackageZipFiles(TestCase): @@ -32,6 +33,10 @@ def setUp(self): def tearDown(self): shutil.rmtree(self.rootdir) + @skip_if_windows( + "Symlinks are not supported on Python 2.x + Windows, and require " + "administrator privleges on Python 3.x + Windows." + ) def test_must_follow_symlinks(self): data = "hello world" data_file = os.path.join(self.rootdir, "data.txt") @@ -51,6 +56,6 @@ def test_must_follow_symlinks(self): # Data file should be the only file within the zip self.assertEquals(["data-link.txt"], myzip.namelist()) myfile = myzip.open("data-link.txt", "r") - + # Its content should be equal the value we wrote. self.assertEquals(data.encode("utf-8"), myfile.read()) diff --git a/tests/functional/eks/test_update_kubeconfig.py b/tests/functional/eks/test_update_kubeconfig.py index 4929812ae1e4..fbd8e22edafb 100644 --- a/tests/functional/eks/test_update_kubeconfig.py +++ b/tests/functional/eks/test_update_kubeconfig.py @@ -36,8 +36,6 @@ describe_cluster_creating_response, get_testdata) -is_windows = sys.platform == 'win32' - def sanitize_output(output): """ Trims output and removes all lines after a line starting with warning. @@ -53,11 +51,6 @@ def sanitize_output(output): to_return += '\n' return to_return.strip() -def return_platform_filename(fileName): - if is_windows: - return fileName+"_windows" - return fileName - def build_environment(entries): """ Build an environment variable from a list of strings. """ return os.path.pathsep.join(entries) @@ -76,6 +69,7 @@ def setUp(self): self.mock_create_client.return_value = self.client self.command = UpdateKubeconfigCommand(self.session) + self.maxDiff = None def tearDown(self): self.create_client_patch.stop() @@ -149,8 +143,7 @@ def assert_config_state(self, config_name, correct_output_name): def assert_cmd_dry(self, passed_config, env_variable_configs, - default_config=os.path.join(".kube", "config"), - role=None): + default_config=os.path.join(".kube", "config")): """ Run update-kubeconfig using dry-run, assert_cmd_dry runs directly referencing the testdata directory, @@ -178,8 +171,6 @@ def assert_cmd_dry(self, passed_config, args = ["--name", "ExampleCluster", "--dry-run"] if passed_config is not None: args += ["--kubeconfig", get_testdata(passed_config)] - if role is not None: - args += ["--role-arn", "RoleArn"] with capture_output() as captured: with mock.patch.dict(os.environ, {'KUBECONFIG': env_variable}): @@ -197,7 +188,7 @@ def assert_cmd_dry(self, passed_config, def assert_cmd(self, configs, passed_config, env_variable_configs, default_config=os.path.join(".kube", "config"), - role=None, verbose=False): + verbose=False): """ Run update-kubeconfig in a temp directory, This directory will have copies of all testdata files whose names @@ -225,8 +216,6 @@ def assert_cmd(self, configs, passed_config, args = ["--name", "ExampleCluster"] if passed_config is not None: args += ["--kubeconfig", self._get_temp_config(passed_config)] - if role is not None: - args += ["--role-arn", "RoleArn"] if verbose: args += ["--verbose"] @@ -245,21 +234,21 @@ def test_dry_run_new(self): environment = [] captured_output = self.assert_cmd_dry(passed, environment) - self.assert_output(captured_output, return_platform_filename('output_single')) + self.assert_output(captured_output, 'output_single') def test_dry_run_existing(self): passed = "valid_existing" environment = [] captured_output = self.assert_cmd_dry(passed, environment) - self.assert_output(captured_output, return_platform_filename('output_combined')) + self.assert_output(captured_output, 'output_combined') def test_dry_run_empty(self): passed = "valid_empty_config" environment = [] captured_output = self.assert_cmd_dry(passed, environment) - self.assert_output(captured_output, return_platform_filename('output_single')) + self.assert_output(captured_output, 'output_single') def test_dry_run_corrupted(self): passed = "invalid_string_clusters" @@ -274,7 +263,7 @@ def test_write_new(self): environment = [] self.assert_cmd(configs, passed, environment) - self.assert_config_state("new_config", return_platform_filename("output_single")) + self.assert_config_state("new_config", "output_single") def test_use_environment(self): configs = ['invalid_string_clusters', @@ -287,7 +276,7 @@ def test_use_environment(self): 'valid_existing'] self.assert_cmd(configs, passed, environment) - self.assert_config_state("does_not_exist", return_platform_filename("output_single")) + self.assert_config_state("does_not_exist", "output_single") def test_use_default(self): configs = ["valid_existing"] @@ -296,7 +285,7 @@ def test_use_default(self): default = "valid_existing" self.assert_cmd(configs, passed, environment, default, verbose=True) - self.assert_config_state("valid_existing", return_platform_filename("output_combined")) + self.assert_config_state("valid_existing", "output_combined") def test_all_corrupted(self): configs = ["invalid_string_cluster_entry", @@ -322,7 +311,7 @@ def test_all_but_one_corrupted(self): "invalid_text"] self.assert_cmd(configs, passed, environment) - self.assert_config_state("valid_existing", return_platform_filename('output_combined')) + self.assert_config_state("valid_existing", 'output_combined') def test_corrupted_and_missing(self): configs = ["invalid_string_clusters", @@ -363,8 +352,7 @@ def test_environmemt_empty_elements(self): self.mock_create_client.assert_called_once_with('eks') self.client\ .describe_cluster.assert_called_once_with(name='ExampleCluster') - self.assert_config_state("valid_existing", - return_platform_filename("output_combined")) + self.assert_config_state("valid_existing", "output_combined") def test_environmemt_all_empty(self): configs = ["valid_existing"] @@ -382,7 +370,7 @@ def test_environmemt_all_empty(self): self.mock_create_client.assert_called_once_with('eks') self.client\ .describe_cluster.assert_called_once_with(name='ExampleCluster') - self.assert_config_state("default_temp", return_platform_filename("output_single")) + self.assert_config_state("default_temp", "output_single") def test_default_path_directory(self): configs = [] @@ -395,24 +383,22 @@ def test_default_path_directory(self): self.assert_cmd(configs, passed, environment, default) def test_update_existing(self): - configs = ["output_combined"] - passed = "output_combined" + configs = ["valid_old_data"] + passed = "valid_old_data" environment = [] - self.assert_cmd(configs, passed, environment, role="RoleArn") - self.assert_config_state("output_combined", - return_platform_filename("output_combined_with_role")) + self.assert_cmd(configs, passed, environment) + self.assert_config_state("valid_old_data", "output_combined") def test_update_existing_environment(self): - configs = ["output_combined"] + configs = ["valid_old_data"] passed = None - environment = ["output_combined", - "output_combined_with_role", + environment = ["valid_old_data", + "output_combined", "output_single"] - self.assert_cmd(configs, passed, environment, role="RoleArn") - self.assert_config_state("output_combined", - return_platform_filename("output_combined_with_role")) + self.assert_cmd(configs, passed, environment) + self.assert_config_state("valid_old_data", "output_combined") def test_cluster_creating(self): configs = ["output_combined"] @@ -429,6 +415,5 @@ def test_kubeconfig_order(self): environment = [] self.assert_cmd(configs, passed, environment) - self.assert_config_state("valid_changed_ordering", - return_platform_filename("output_combined_changed_ordering")) + self.assert_config_state("valid_changed_ordering", "output_combined_changed_ordering") diff --git a/tests/functional/eks/testdata/invalid_string_cluster_entry b/tests/functional/eks/testdata/invalid_string_cluster_entry index b244d9c44f1f..3445428dfa90 100644 --- a/tests/functional/eks/testdata/invalid_string_cluster_entry +++ b/tests/functional/eks/testdata/invalid_string_cluster_entry @@ -15,8 +15,11 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws diff --git a/tests/functional/eks/testdata/invalid_string_clusters b/tests/functional/eks/testdata/invalid_string_clusters index 09f112dc86c4..f6eeb57fd9a8 100644 --- a/tests/functional/eks/testdata/invalid_string_clusters +++ b/tests/functional/eks/testdata/invalid_string_clusters @@ -14,8 +14,11 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws diff --git a/tests/functional/eks/testdata/invalid_string_context_entry b/tests/functional/eks/testdata/invalid_string_context_entry index b2f042deca88..3762197aaf6b 100644 --- a/tests/functional/eks/testdata/invalid_string_context_entry +++ b/tests/functional/eks/testdata/invalid_string_context_entry @@ -15,8 +15,11 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws diff --git a/tests/functional/eks/testdata/invalid_string_contexts b/tests/functional/eks/testdata/invalid_string_contexts index 1697e69f6d14..07c34aa406f3 100644 --- a/tests/functional/eks/testdata/invalid_string_contexts +++ b/tests/functional/eks/testdata/invalid_string_contexts @@ -14,8 +14,11 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws diff --git a/tests/functional/eks/testdata/output_combined b/tests/functional/eks/testdata/output_combined index 6f42b163b3fc..4c097a5a4e03 100644 --- a/tests/functional/eks/testdata/output_combined +++ b/tests/functional/eks/testdata/output_combined @@ -26,17 +26,23 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws - name: arn:aws:eks:region:111222333444:cluster/ExampleCluster user: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - region + - eks + - get-token + - --cluster-name - ExampleCluster - command: aws-iam-authenticator + command: aws diff --git a/tests/functional/eks/testdata/output_combined_changed_ordering b/tests/functional/eks/testdata/output_combined_changed_ordering index a2bfcc2f6672..fea7a86524c6 100644 --- a/tests/functional/eks/testdata/output_combined_changed_ordering +++ b/tests/functional/eks/testdata/output_combined_changed_ordering @@ -4,19 +4,25 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws - name: arn:aws:eks:region:111222333444:cluster/ExampleCluster user: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - region + - eks + - get-token + - --cluster-name - ExampleCluster - command: aws-iam-authenticator + command: aws clusters: - cluster: certificate-authority-data: DATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATA= diff --git a/tests/functional/eks/testdata/output_combined_windows b/tests/functional/eks/testdata/output_combined_windows deleted file mode 100644 index 15de5713ba5d..000000000000 --- a/tests/functional/eks/testdata/output_combined_windows +++ /dev/null @@ -1,42 +0,0 @@ -apiVersion: v1 -clusters: -- cluster: - certificate-authority-data: DATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATA= - server: https://existingEndpoint.eks.amazonaws.com - name: arn:aws:eks:us-west-2:111222333444:cluster/Existing -- cluster: - certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tDQpWR1Z6ZEdsdVp5QkVZWFJoRFFwVVpYTjBhVzVuSUVSaGRHRU5DbFJsYzNScGJtY2dSR0YwWVEwS2EzVmlaWEp1WlhSbGN6QWVGdzBLVkdWemRHbHVaeUJFWVhSaERRcFVaWE4wYVc1bklFUmhkR0ZWQkFNVERRcHJkV0psY201bGRHVnpNQUVpTUEwS1ZHVnpkR2x1WnlCRVlYUmhEUXBVWlhOMGFXNW5JRVJoZEdFTkNsUmxjM1JwYm1jZ1JHRjBZY3UvR1FnbmFTcDNZaHBDTWhGVVpYTjBhVzVuSUVSaGRHRXl3clZqeEpWNjNwNFVHRmpZdHdGR1drUldJVkV1VkdWemRHbHVaeUJFWVhSaGJzT0MxSVJiTDhPd0lpMVhiWGg2VkdWemRHbHVaeUJFWVhSaFpXVndTTk9VVUZKNmN5QWJaaFpnWVNkTUV3MEtGMVJsYzNScGJtY2dSR0YwWVFZRFZSMFBBUUVFQkFNQ0FsUmxjM1JwYm1jZ1JHRjBZUUV3RFFvR0NTcElEUXBVWlhOMGFXNW5JRVJoZEdGcEgxc1pPRTNMa3lrMU9DWUNHUloyTEZjM3paOCtHell3WEZSbGMzUnBibWNnUkdGMFlYMUR5NjFNMVlGV1AxWVRIMVJsYzNScGJtY2dSR0YwWVd0aE5oMVphM2dWUDBGaGNSWjdKaW9oZVc4N1JsUmxjM1JwYm1jZ1JHRjBZUVpIVHd4NE9IdzZmZz09DQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0t - server: https://endpoint.amazonaws.com - name: arn:aws:eks:region:111222333444:cluster/ExampleCluster -contexts: -- context: - cluster: arn:aws:eks:us-west-2:111222333444:cluster/Existing - user: arn:aws:eks:us-west-2:111222333444:cluster/Existing - name: arn:aws:eks:us-west-2:111222333444:cluster/Existing -- context: - cluster: arn:aws:eks:region:111222333444:cluster/ExampleCluster - user: arn:aws:eks:region:111222333444:cluster/ExampleCluster - name: arn:aws:eks:region:111222333444:cluster/ExampleCluster -current-context: arn:aws:eks:region:111222333444:cluster/ExampleCluster -kind: Config -preferences: {} -users: -- name: arn:aws:eks:us-west-2:111222333444:cluster/Existing - user: - exec: - apiVersion: client.authentication.k8s.io/v1alpha1 - args: - - token - - -i - - Existing - command: aws-iam-authenticator -- name: arn:aws:eks:region:111222333444:cluster/ExampleCluster - user: - exec: - apiVersion: client.authentication.k8s.io/v1alpha1 - args: - - token - - -i - - ExampleCluster - command: aws-iam-authenticator.exe - diff --git a/tests/functional/eks/testdata/output_combined_with_role b/tests/functional/eks/testdata/output_combined_with_role deleted file mode 100644 index a3f26ccbbf9a..000000000000 --- a/tests/functional/eks/testdata/output_combined_with_role +++ /dev/null @@ -1,44 +0,0 @@ -apiVersion: v1 -clusters: -- cluster: - certificate-authority-data: DATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATA= - server: https://existingEndpoint.eks.amazonaws.com - name: arn:aws:eks:us-west-2:111222333444:cluster/Existing -- cluster: - certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tDQpWR1Z6ZEdsdVp5QkVZWFJoRFFwVVpYTjBhVzVuSUVSaGRHRU5DbFJsYzNScGJtY2dSR0YwWVEwS2EzVmlaWEp1WlhSbGN6QWVGdzBLVkdWemRHbHVaeUJFWVhSaERRcFVaWE4wYVc1bklFUmhkR0ZWQkFNVERRcHJkV0psY201bGRHVnpNQUVpTUEwS1ZHVnpkR2x1WnlCRVlYUmhEUXBVWlhOMGFXNW5JRVJoZEdFTkNsUmxjM1JwYm1jZ1JHRjBZY3UvR1FnbmFTcDNZaHBDTWhGVVpYTjBhVzVuSUVSaGRHRXl3clZqeEpWNjNwNFVHRmpZdHdGR1drUldJVkV1VkdWemRHbHVaeUJFWVhSaGJzT0MxSVJiTDhPd0lpMVhiWGg2VkdWemRHbHVaeUJFWVhSaFpXVndTTk9VVUZKNmN5QWJaaFpnWVNkTUV3MEtGMVJsYzNScGJtY2dSR0YwWVFZRFZSMFBBUUVFQkFNQ0FsUmxjM1JwYm1jZ1JHRjBZUUV3RFFvR0NTcElEUXBVWlhOMGFXNW5JRVJoZEdGcEgxc1pPRTNMa3lrMU9DWUNHUloyTEZjM3paOCtHell3WEZSbGMzUnBibWNnUkdGMFlYMUR5NjFNMVlGV1AxWVRIMVJsYzNScGJtY2dSR0YwWVd0aE5oMVphM2dWUDBGaGNSWjdKaW9oZVc4N1JsUmxjM1JwYm1jZ1JHRjBZUVpIVHd4NE9IdzZmZz09DQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0t - server: https://endpoint.amazonaws.com - name: arn:aws:eks:region:111222333444:cluster/ExampleCluster -contexts: -- context: - cluster: arn:aws:eks:us-west-2:111222333444:cluster/Existing - user: arn:aws:eks:us-west-2:111222333444:cluster/Existing - name: arn:aws:eks:us-west-2:111222333444:cluster/Existing -- context: - cluster: arn:aws:eks:region:111222333444:cluster/ExampleCluster - user: arn:aws:eks:region:111222333444:cluster/ExampleCluster - name: arn:aws:eks:region:111222333444:cluster/ExampleCluster -current-context: arn:aws:eks:region:111222333444:cluster/ExampleCluster -kind: Config -preferences: {} -users: -- name: arn:aws:eks:us-west-2:111222333444:cluster/Existing - user: - exec: - apiVersion: client.authentication.k8s.io/v1alpha1 - args: - - token - - -i - - Existing - command: aws-iam-authenticator -- name: arn:aws:eks:region:111222333444:cluster/ExampleCluster - user: - exec: - apiVersion: client.authentication.k8s.io/v1alpha1 - args: - - token - - -i - - ExampleCluster - - -r - - RoleArn - command: aws-iam-authenticator - diff --git a/tests/functional/eks/testdata/output_combined_with_role_windows b/tests/functional/eks/testdata/output_combined_with_role_windows deleted file mode 100644 index 513739b5d5ea..000000000000 --- a/tests/functional/eks/testdata/output_combined_with_role_windows +++ /dev/null @@ -1,44 +0,0 @@ -apiVersion: v1 -clusters: -- cluster: - certificate-authority-data: DATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATA= - server: https://existingEndpoint.eks.amazonaws.com - name: arn:aws:eks:us-west-2:111222333444:cluster/Existing -- cluster: - certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tDQpWR1Z6ZEdsdVp5QkVZWFJoRFFwVVpYTjBhVzVuSUVSaGRHRU5DbFJsYzNScGJtY2dSR0YwWVEwS2EzVmlaWEp1WlhSbGN6QWVGdzBLVkdWemRHbHVaeUJFWVhSaERRcFVaWE4wYVc1bklFUmhkR0ZWQkFNVERRcHJkV0psY201bGRHVnpNQUVpTUEwS1ZHVnpkR2x1WnlCRVlYUmhEUXBVWlhOMGFXNW5JRVJoZEdFTkNsUmxjM1JwYm1jZ1JHRjBZY3UvR1FnbmFTcDNZaHBDTWhGVVpYTjBhVzVuSUVSaGRHRXl3clZqeEpWNjNwNFVHRmpZdHdGR1drUldJVkV1VkdWemRHbHVaeUJFWVhSaGJzT0MxSVJiTDhPd0lpMVhiWGg2VkdWemRHbHVaeUJFWVhSaFpXVndTTk9VVUZKNmN5QWJaaFpnWVNkTUV3MEtGMVJsYzNScGJtY2dSR0YwWVFZRFZSMFBBUUVFQkFNQ0FsUmxjM1JwYm1jZ1JHRjBZUUV3RFFvR0NTcElEUXBVWlhOMGFXNW5JRVJoZEdGcEgxc1pPRTNMa3lrMU9DWUNHUloyTEZjM3paOCtHell3WEZSbGMzUnBibWNnUkdGMFlYMUR5NjFNMVlGV1AxWVRIMVJsYzNScGJtY2dSR0YwWVd0aE5oMVphM2dWUDBGaGNSWjdKaW9oZVc4N1JsUmxjM1JwYm1jZ1JHRjBZUVpIVHd4NE9IdzZmZz09DQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0t - server: https://endpoint.amazonaws.com - name: arn:aws:eks:region:111222333444:cluster/ExampleCluster -contexts: -- context: - cluster: arn:aws:eks:us-west-2:111222333444:cluster/Existing - user: arn:aws:eks:us-west-2:111222333444:cluster/Existing - name: arn:aws:eks:us-west-2:111222333444:cluster/Existing -- context: - cluster: arn:aws:eks:region:111222333444:cluster/ExampleCluster - user: arn:aws:eks:region:111222333444:cluster/ExampleCluster - name: arn:aws:eks:region:111222333444:cluster/ExampleCluster -current-context: arn:aws:eks:region:111222333444:cluster/ExampleCluster -kind: Config -preferences: {} -users: -- name: arn:aws:eks:us-west-2:111222333444:cluster/Existing - user: - exec: - apiVersion: client.authentication.k8s.io/v1alpha1 - args: - - token - - -i - - Existing - command: aws-iam-authenticator -- name: arn:aws:eks:region:111222333444:cluster/ExampleCluster - user: - exec: - apiVersion: client.authentication.k8s.io/v1alpha1 - args: - - token - - -i - - ExampleCluster - - -r - - RoleArn - command: aws-iam-authenticator.exe - diff --git a/tests/functional/eks/testdata/output_single b/tests/functional/eks/testdata/output_single index cd9858730d1b..20e776b5fc39 100644 --- a/tests/functional/eks/testdata/output_single +++ b/tests/functional/eks/testdata/output_single @@ -18,7 +18,10 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - region + - eks + - get-token + - --cluster-name - ExampleCluster - command: aws-iam-authenticator + command: aws diff --git a/tests/functional/eks/testdata/output_single_windows b/tests/functional/eks/testdata/output_single_windows deleted file mode 100644 index eef3d04ede06..000000000000 --- a/tests/functional/eks/testdata/output_single_windows +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: v1 -clusters: -- cluster: - certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tDQpWR1Z6ZEdsdVp5QkVZWFJoRFFwVVpYTjBhVzVuSUVSaGRHRU5DbFJsYzNScGJtY2dSR0YwWVEwS2EzVmlaWEp1WlhSbGN6QWVGdzBLVkdWemRHbHVaeUJFWVhSaERRcFVaWE4wYVc1bklFUmhkR0ZWQkFNVERRcHJkV0psY201bGRHVnpNQUVpTUEwS1ZHVnpkR2x1WnlCRVlYUmhEUXBVWlhOMGFXNW5JRVJoZEdFTkNsUmxjM1JwYm1jZ1JHRjBZY3UvR1FnbmFTcDNZaHBDTWhGVVpYTjBhVzVuSUVSaGRHRXl3clZqeEpWNjNwNFVHRmpZdHdGR1drUldJVkV1VkdWemRHbHVaeUJFWVhSaGJzT0MxSVJiTDhPd0lpMVhiWGg2VkdWemRHbHVaeUJFWVhSaFpXVndTTk9VVUZKNmN5QWJaaFpnWVNkTUV3MEtGMVJsYzNScGJtY2dSR0YwWVFZRFZSMFBBUUVFQkFNQ0FsUmxjM1JwYm1jZ1JHRjBZUUV3RFFvR0NTcElEUXBVWlhOMGFXNW5JRVJoZEdGcEgxc1pPRTNMa3lrMU9DWUNHUloyTEZjM3paOCtHell3WEZSbGMzUnBibWNnUkdGMFlYMUR5NjFNMVlGV1AxWVRIMVJsYzNScGJtY2dSR0YwWVd0aE5oMVphM2dWUDBGaGNSWjdKaW9oZVc4N1JsUmxjM1JwYm1jZ1JHRjBZUVpIVHd4NE9IdzZmZz09DQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0t - server: https://endpoint.amazonaws.com - name: arn:aws:eks:region:111222333444:cluster/ExampleCluster -contexts: -- context: - cluster: arn:aws:eks:region:111222333444:cluster/ExampleCluster - user: arn:aws:eks:region:111222333444:cluster/ExampleCluster - name: arn:aws:eks:region:111222333444:cluster/ExampleCluster -current-context: arn:aws:eks:region:111222333444:cluster/ExampleCluster -kind: Config -preferences: {} -users: -- name: arn:aws:eks:region:111222333444:cluster/ExampleCluster - user: - exec: - apiVersion: client.authentication.k8s.io/v1alpha1 - args: - - token - - -i - - ExampleCluster - command: aws-iam-authenticator.exe diff --git a/tests/functional/eks/testdata/output_single_with_role b/tests/functional/eks/testdata/output_single_with_role deleted file mode 100644 index 513b6e8059e1..000000000000 --- a/tests/functional/eks/testdata/output_single_with_role +++ /dev/null @@ -1,26 +0,0 @@ -apiVersion: v1 -clusters: -- cluster: - certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tDQpWR1Z6ZEdsdVp5QkVZWFJoRFFwVVpYTjBhVzVuSUVSaGRHRU5DbFJsYzNScGJtY2dSR0YwWVEwS2EzVmlaWEp1WlhSbGN6QWVGdzBLVkdWemRHbHVaeUJFWVhSaERRcFVaWE4wYVc1bklFUmhkR0ZWQkFNVERRcHJkV0psY201bGRHVnpNQUVpTUEwS1ZHVnpkR2x1WnlCRVlYUmhEUXBVWlhOMGFXNW5JRVJoZEdFTkNsUmxjM1JwYm1jZ1JHRjBZY3UvR1FnbmFTcDNZaHBDTWhGVVpYTjBhVzVuSUVSaGRHRXl3clZqeEpWNjNwNFVHRmpZdHdGR1drUldJVkV1VkdWemRHbHVaeUJFWVhSaGJzT0MxSVJiTDhPd0lpMVhiWGg2VkdWemRHbHVaeUJFWVhSaFpXVndTTk9VVUZKNmN5QWJaaFpnWVNkTUV3MEtGMVJsYzNScGJtY2dSR0YwWVFZRFZSMFBBUUVFQkFNQ0FsUmxjM1JwYm1jZ1JHRjBZUUV3RFFvR0NTcElEUXBVWlhOMGFXNW5JRVJoZEdGcEgxc1pPRTNMa3lrMU9DWUNHUloyTEZjM3paOCtHell3WEZSbGMzUnBibWNnUkdGMFlYMUR5NjFNMVlGV1AxWVRIMVJsYzNScGJtY2dSR0YwWVd0aE5oMVphM2dWUDBGaGNSWjdKaW9oZVc4N1JsUmxjM1JwYm1jZ1JHRjBZUVpIVHd4NE9IdzZmZz09DQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0t - server: https://endpoint.amazonaws.com - name: arn:aws:eks:region:111222333444:cluster/ExampleCluster -contexts: -- context: - cluster: arn:aws:eks:region:111222333444:cluster/ExampleCluster - user: arn:aws:eks:region:111222333444:cluster/ExampleCluster - name: arn:aws:eks:region:111222333444:cluster/ExampleCluster -current-context: arn:aws:eks:region:111222333444:cluster/ExampleCluster -kind: Config -preferences: {} -users: -- name: arn:aws:eks:region:111222333444:cluster/ExampleCluster - user: - exec: - apiVersion: client.authentication.k8s.io/v1alpha1 - args: - - token - - -i - - ExampleCluster - - -r - - RoleArn - command: aws-iam-authenticator diff --git a/tests/functional/eks/testdata/valid_bad_cluster b/tests/functional/eks/testdata/valid_bad_cluster index e087f6e07155..3c3ae4702c0d 100644 --- a/tests/functional/eks/testdata/valid_bad_cluster +++ b/tests/functional/eks/testdata/valid_bad_cluster @@ -15,8 +15,11 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws diff --git a/tests/functional/eks/testdata/valid_bad_cluster2 b/tests/functional/eks/testdata/valid_bad_cluster2 index 5d0abfb7c84c..a99fe2ffc6ef 100644 --- a/tests/functional/eks/testdata/valid_bad_cluster2 +++ b/tests/functional/eks/testdata/valid_bad_cluster2 @@ -17,8 +17,10 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator - + command: aws diff --git a/tests/functional/eks/testdata/valid_bad_context b/tests/functional/eks/testdata/valid_bad_context index 296a59d9c107..cadf61557e60 100644 --- a/tests/functional/eks/testdata/valid_bad_context +++ b/tests/functional/eks/testdata/valid_bad_context @@ -15,8 +15,11 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws diff --git a/tests/functional/eks/testdata/valid_bad_context2 b/tests/functional/eks/testdata/valid_bad_context2 index 2012e130c31d..b3e1e6f2c29b 100644 --- a/tests/functional/eks/testdata/valid_bad_context2 +++ b/tests/functional/eks/testdata/valid_bad_context2 @@ -17,8 +17,11 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws diff --git a/tests/functional/eks/testdata/valid_bad_user b/tests/functional/eks/testdata/valid_bad_user index 4e05f8bbd20a..30287eadb34e 100644 --- a/tests/functional/eks/testdata/valid_bad_user +++ b/tests/functional/eks/testdata/valid_bad_user @@ -17,8 +17,11 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws diff --git a/tests/functional/eks/testdata/valid_changed_ordering b/tests/functional/eks/testdata/valid_changed_ordering index 5d2c3f30ea7f..5dc823f7a925 100644 --- a/tests/functional/eks/testdata/valid_changed_ordering +++ b/tests/functional/eks/testdata/valid_changed_ordering @@ -4,10 +4,13 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws clusters: - cluster: certificate-authority-data: DATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATA= diff --git a/tests/functional/eks/testdata/valid_existing b/tests/functional/eks/testdata/valid_existing index f020b7b46843..9a00b4e3ef14 100644 --- a/tests/functional/eks/testdata/valid_existing +++ b/tests/functional/eks/testdata/valid_existing @@ -18,8 +18,11 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws diff --git a/tests/functional/eks/testdata/valid_existing_with_role b/tests/functional/eks/testdata/valid_existing_with_role deleted file mode 100644 index 00ca80d9834f..000000000000 --- a/tests/functional/eks/testdata/valid_existing_with_role +++ /dev/null @@ -1,27 +0,0 @@ -apiVersion: v1 -clusters: -- cluster: - certificate-authority-data: DATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATA= - server: https://existingEndpoint.eks.amazonaws.com - name: arn:aws:eks:us-west-2:111222333444:cluster/Existing -contexts: -- context: - cluster: arn:aws:eks:us-west-2:111222333444:cluster/Existing - user: arn:aws:eks:us-west-2:111222333444:cluster/Existing - name: arn:aws:eks:us-west-2:111222333444:cluster/Existing -current-context: arn:aws:eks:us-west-2:111222333444:cluster/Existing -kind: Config -preferences: {} -users: -- name: arn:aws:eks:us-west-2:111222333444:cluster/Existing - user: - exec: - apiVersion: client.authentication.k8s.io/v1alpha1 - args: - - token - - -i - - Existing - - -r - - RoleArn - command: aws-iam-authenticator - diff --git a/tests/functional/eks/testdata/valid_no_cluster b/tests/functional/eks/testdata/valid_no_cluster index d6dd9fdcb98c..4da6bae2e105 100644 --- a/tests/functional/eks/testdata/valid_no_cluster +++ b/tests/functional/eks/testdata/valid_no_cluster @@ -13,9 +13,12 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws diff --git a/tests/functional/eks/testdata/valid_no_context b/tests/functional/eks/testdata/valid_no_context index 64373d3e82d8..d98d38ed6af9 100644 --- a/tests/functional/eks/testdata/valid_no_context +++ b/tests/functional/eks/testdata/valid_no_context @@ -13,8 +13,11 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws diff --git a/tests/functional/eks/testdata/valid_no_current_context b/tests/functional/eks/testdata/valid_no_current_context index 8f41af5fb7d8..0bb78320e3bd 100644 --- a/tests/functional/eks/testdata/valid_no_current_context +++ b/tests/functional/eks/testdata/valid_no_current_context @@ -17,8 +17,11 @@ users: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - - token - - -i + - --region + - us-west-2 + - eks + - get-token + - --cluster-name - Existing - command: aws-iam-authenticator + command: aws diff --git a/tests/functional/eks/testdata/output_combined_changed_ordering_windows b/tests/functional/eks/testdata/valid_old_data similarity index 95% rename from tests/functional/eks/testdata/output_combined_changed_ordering_windows rename to tests/functional/eks/testdata/valid_old_data index 501c2a675b42..525c7e56da08 100644 --- a/tests/functional/eks/testdata/output_combined_changed_ordering_windows +++ b/tests/functional/eks/testdata/valid_old_data @@ -1,22 +1,4 @@ -users: -- name: arn:aws:eks:us-west-2:111222333444:cluster/Existing - user: - exec: - apiVersion: client.authentication.k8s.io/v1alpha1 - args: - - token - - -i - - Existing - command: aws-iam-authenticator -- name: arn:aws:eks:region:111222333444:cluster/ExampleCluster - user: - exec: - apiVersion: client.authentication.k8s.io/v1alpha1 - args: - - token - - -i - - ExampleCluster - command: aws-iam-authenticator.exe +apiVersion: v1 clusters: - cluster: certificate-authority-data: DATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATADATA= @@ -26,7 +8,6 @@ clusters: certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tDQpWR1Z6ZEdsdVp5QkVZWFJoRFFwVVpYTjBhVzVuSUVSaGRHRU5DbFJsYzNScGJtY2dSR0YwWVEwS2EzVmlaWEp1WlhSbGN6QWVGdzBLVkdWemRHbHVaeUJFWVhSaERRcFVaWE4wYVc1bklFUmhkR0ZWQkFNVERRcHJkV0psY201bGRHVnpNQUVpTUEwS1ZHVnpkR2x1WnlCRVlYUmhEUXBVWlhOMGFXNW5JRVJoZEdFTkNsUmxjM1JwYm1jZ1JHRjBZY3UvR1FnbmFTcDNZaHBDTWhGVVpYTjBhVzVuSUVSaGRHRXl3clZqeEpWNjNwNFVHRmpZdHdGR1drUldJVkV1VkdWemRHbHVaeUJFWVhSaGJzT0MxSVJiTDhPd0lpMVhiWGg2VkdWemRHbHVaeUJFWVhSaFpXVndTTk9VVUZKNmN5QWJaaFpnWVNkTUV3MEtGMVJsYzNScGJtY2dSR0YwWVFZRFZSMFBBUUVFQkFNQ0FsUmxjM1JwYm1jZ1JHRjBZUUV3RFFvR0NTcElEUXBVWlhOMGFXNW5JRVJoZEdGcEgxc1pPRTNMa3lrMU9DWUNHUloyTEZjM3paOCtHell3WEZSbGMzUnBibWNnUkdGMFlYMUR5NjFNMVlGV1AxWVRIMVJsYzNScGJtY2dSR0YwWVd0aE5oMVphM2dWUDBGaGNSWjdKaW9oZVc4N1JsUmxjM1JwYm1jZ1JHRjBZUVpIVHd4NE9IdzZmZz09DQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0t server: https://endpoint.amazonaws.com name: arn:aws:eks:region:111222333444:cluster/ExampleCluster -kind: Config contexts: - context: cluster: arn:aws:eks:us-west-2:111222333444:cluster/Existing @@ -37,5 +18,27 @@ contexts: user: arn:aws:eks:region:111222333444:cluster/ExampleCluster name: arn:aws:eks:region:111222333444:cluster/ExampleCluster current-context: arn:aws:eks:region:111222333444:cluster/ExampleCluster +kind: Config preferences: {} -apiVersion: v1 +users: +- name: arn:aws:eks:us-west-2:111222333444:cluster/Existing + user: + exec: + apiVersion: client.authentication.k8s.io/v1alpha1 + args: + - --region + - us-west-2 + - eks + - get-token + - --cluster-name + - Existing + command: aws +- name: arn:aws:eks:region:111222333444:cluster/ExampleCluster + user: + exec: + apiVersion: client.authentication.k8s.io/v1alpha1 + args: + - token + - -i + - ExampleCluster + command: aws-iam-authenticator diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.py index 70831f694264..08d06f48e348 100644 --- a/tests/integration/test_cli.py +++ b/tests/integration/test_cli.py @@ -75,7 +75,7 @@ def test_operation_help_output(self): # we eventually should update this test to check exactly for # 'The describe-instances operation'. self.assertRegexpMatches(p.stdout, - '\s+Describes\s+one\s+or\s+more') + '\s+Describes\s+the\s+specified\s+instances') def test_topic_list_help_output(self): p = aws('help topics') diff --git a/tests/unit/customizations/cloudformation/test_artifact_exporter.py b/tests/unit/customizations/cloudformation/test_artifact_exporter.py index 8964b6c97056..31ddf5e7a363 100644 --- a/tests/unit/customizations/cloudformation/test_artifact_exporter.py +++ b/tests/unit/customizations/cloudformation/test_artifact_exporter.py @@ -1027,32 +1027,74 @@ def test_template_global_export(self, yaml_parse_mock): self.assertTrue({"Name": "AWS::Include", "Parameters": {"Location": "foo.yaml"}} in call_args) self.assertTrue({"Name": "AWS::OtherTransform"} in call_args) self.assertTrue({"Name": "AWS::Include", "Parameters": {"Location": "bar.yaml"}} in call_args) + self.assertTrue(template_dir in first_call_args) + self.assertTrue(template_dir in second_call_args) + self.assertTrue(template_dir in third_call_args) self.assertEquals(include_transform_export_handler_mock.call_count, 3) #new s3 url is added to include location self.assertEquals(exported_template["Resources"]["Resource1"]["Properties"]["Fn::Transform"], {"Name": "AWS::Include", "Parameters": {"Location": "s3://foo"}}) self.assertEquals(exported_template["List"][1]["Fn::Transform"], {"Name": "AWS::Include", "Parameters": {"Location": "s3://foo"}}) @patch("awscli.customizations.cloudformation.artifact_exporter.is_local_file") - def test_include_transform_export_handler(self, is_local_file_mock): + def test_include_transform_export_handler_with_relative_file_path(self, is_local_file_mock): #exports transform + parent_dir = os.path.abspath("someroot") self.s3_uploader_mock.upload_with_dedup.return_value = "s3://foo" is_local_file_mock.return_value = True - handler_output = include_transform_export_handler({"Name": "AWS::Include", "Parameters": {"Location": "foo.yaml"}}, self.s3_uploader_mock) - self.s3_uploader_mock.upload_with_dedup.assert_called_once_with("foo.yaml") + abs_file_path = os.path.join(parent_dir, "foo.yaml") + + handler_output = include_transform_export_handler({"Name": "AWS::Include", "Parameters": {"Location": "foo.yaml"}}, self.s3_uploader_mock, parent_dir) + self.s3_uploader_mock.upload_with_dedup.assert_called_once_with(abs_file_path) + is_local_file_mock.assert_called_with(abs_file_path) + self.assertEquals(handler_output, {'Name': 'AWS::Include', 'Parameters': {'Location': 's3://foo'}}) + + @patch("awscli.customizations.cloudformation.artifact_exporter.is_local_file") + def test_include_transform_export_handler_with_absolute_file_path(self, is_local_file_mock): + #exports transform + parent_dir = os.path.abspath("someroot") + self.s3_uploader_mock.upload_with_dedup.return_value = "s3://foo" + is_local_file_mock.return_value = True + abs_file_path = os.path.abspath(os.path.join("my", "file.yaml")) + + handler_output = include_transform_export_handler({"Name": "AWS::Include", "Parameters": {"Location": abs_file_path}}, self.s3_uploader_mock, parent_dir) + self.s3_uploader_mock.upload_with_dedup.assert_called_once_with(abs_file_path) + is_local_file_mock.assert_called_with(abs_file_path) self.assertEquals(handler_output, {'Name': 'AWS::Include', 'Parameters': {'Location': 's3://foo'}}) + @patch("awscli.customizations.cloudformation.artifact_exporter.is_local_file") + def test_include_transform_export_handler_with_s3_uri(self, is_local_file_mock): + + handler_output = include_transform_export_handler({"Name": "AWS::Include", "Parameters": {"Location": "s3://bucket/foo.yaml"}}, self.s3_uploader_mock, "parent_dir") + # Input is returned unmodified + self.assertEquals(handler_output, {"Name": "AWS::Include", "Parameters": {"Location": "s3://bucket/foo.yaml"}}) + + is_local_file_mock.assert_not_called() + self.s3_uploader_mock.assert_not_called() + + @patch("awscli.customizations.cloudformation.artifact_exporter.is_local_file") + def test_include_transform_export_handler_with_no_path(self, is_local_file_mock): + + handler_output = include_transform_export_handler({"Name": "AWS::Include", "Parameters": {"Location": ""}}, self.s3_uploader_mock, "parent_dir") + # Input is returned unmodified + self.assertEquals(handler_output, {"Name": "AWS::Include", "Parameters": {"Location": ""}}) + + is_local_file_mock.assert_not_called() + self.s3_uploader_mock.assert_not_called() + @patch("awscli.customizations.cloudformation.artifact_exporter.is_local_file") def test_include_transform_export_handler_non_local_file(self, is_local_file_mock): - #returns unchanged template dict if transform not a local file + #returns unchanged template dict if transform not a local file, and not a S3 URI is_local_file_mock.return_value = False - handler_output = include_transform_export_handler({"Name": "AWS::Include", "Parameters": {"Location": "http://foo.yaml"}}, self.s3_uploader_mock) - self.s3_uploader_mock.upload_with_dedup.assert_not_called() - self.assertEquals(handler_output, {"Name": "AWS::Include", "Parameters": {"Location": "http://foo.yaml"}}) + + with self.assertRaises(exceptions.InvalidLocalPathError): + include_transform_export_handler({"Name": "AWS::Include", "Parameters": {"Location": "http://foo.yaml"}}, self.s3_uploader_mock, "parent_dir") + is_local_file_mock.assert_called_with("http://foo.yaml") + self.s3_uploader_mock.assert_not_called() @patch("awscli.customizations.cloudformation.artifact_exporter.is_local_file") def test_include_transform_export_handler_non_include_transform(self, is_local_file_mock): #ignores transform that is not aws::include - handler_output = include_transform_export_handler({"Name": "AWS::OtherTransform", "Parameters": {"Location": "foo.yaml"}}, self.s3_uploader_mock) + handler_output = include_transform_export_handler({"Name": "AWS::OtherTransform", "Parameters": {"Location": "foo.yaml"}}, self.s3_uploader_mock, "parent_dir") self.s3_uploader_mock.upload_with_dedup.assert_not_called() self.assertEquals(handler_output, {"Name": "AWS::OtherTransform", "Parameters": {"Location": "foo.yaml"}}) diff --git a/tests/unit/customizations/cloudformation/test_deploy.py b/tests/unit/customizations/cloudformation/test_deploy.py index 31d55fd71b73..f000cbe97921 100644 --- a/tests/unit/customizations/cloudformation/test_deploy.py +++ b/tests/unit/customizations/cloudformation/test_deploy.py @@ -212,7 +212,6 @@ def test_s3_uploader_is_configured_properly(self, s3UploaderMock, s3UploaderMock.assert_called_once_with(mock.ANY, bucket_name, - mock.ANY, self.parsed_args.s3_prefix, self.parsed_args.kms_key_id, self.parsed_args.force_upload) diff --git a/tests/unit/customizations/eks/test_get_token.py b/tests/unit/customizations/eks/test_get_token.py new file mode 100644 index 000000000000..7f31c8cb7249 --- /dev/null +++ b/tests/unit/customizations/eks/test_get_token.py @@ -0,0 +1,105 @@ +# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You +# may not use this file except in compliance with the License. A copy of +# the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF +# ANY KIND, either express or implied. See the License for the specific +# language governing permissions and limitations under the License. + +import mock +from mock import patch +import base64 +import datetime +import botocore + +from awscli.testutils import unittest, capture_output +from awscli.customizations.eks.get_token import ( + GetTokenCommand, + TokenGenerator +) + + +REGION = 'us-west-2' +SIGN_REGION = 'us-east-1' +CLUSTER_NAME = 'MyCluster' +DATE_STRING = datetime.date.today().strftime('%Y%m%d') +TOKEN_PREFIX = "k8s-aws-v1." + +CREDENTIALS = 'ABCDEFGHIJKLMNOPQRST' +SECRET_KEY = 'TSRQPONMLKJUHGFEDCBA' +SESSION_TOKEN = 'TOKENTOKENTOKENTOKEN' + +class TestTokenGenerator(unittest.TestCase): + def assert_url_correct(self, url, is_session): + url_no_signature = url[0:-64] + + if is_session: + self.assertIn("X-Amz-Security-Token=" + SESSION_TOKEN + "&", url_no_signature) + + self.assertIn("X-Amz-Credential=" + CREDENTIALS + "%2F", url_no_signature) + self.assertIn("%3Bx-k8s-aws-id&", url_no_signature) + + def setUp(self): + self._session_handler = mock.Mock() + + session = botocore.session.get_session() + session.set_credentials(CREDENTIALS, SECRET_KEY) + self._session = session + + self._session_handler.get_session = mock.Mock(return_value=self._session) + + self._assuming_handler = mock.Mock() + # While assuming a role, you have a session token + assuming_session = botocore.session.get_session() + assuming_session.set_credentials(CREDENTIALS, SECRET_KEY, SESSION_TOKEN) + self._assuming_session = assuming_session + + self._assuming_handler.get_session = mock.Mock(return_value=self._assuming_session) + + self.maxDiff = None + + def test_url(self): + generator = TokenGenerator(REGION, self._session_handler) + url = generator._get_presigned_url(CLUSTER_NAME, None) + self.assert_url_correct(url, False) + + def test_url_sess(self): + generator = TokenGenerator(REGION, self._assuming_handler) + url = generator._get_presigned_url(CLUSTER_NAME, "RoleArn") + print("URL: " + url) + self.assert_url_correct(url, True) + + def test_token(self): + generator = TokenGenerator(REGION, self._session_handler) + token = generator.get_token(CLUSTER_NAME, None) + prefix = token[:len(TOKEN_PREFIX)] + self.assertEqual(prefix, TOKEN_PREFIX) + token_no_prefix = token[len(TOKEN_PREFIX):] + + decrypted_token = base64.urlsafe_b64decode( + token_no_prefix.encode() + ).decode() + self.assert_url_correct(decrypted_token, False) + + @patch.object(TokenGenerator, '_get_presigned_url', return_value='aHR0cHM6Ly9zdHMuYW1hem9uYXdzLmNvbS8=') + def test_token_no_padding(self, mock_presigned_url): + generator = TokenGenerator(REGION, self._session_handler) + tok = generator.get_token(CLUSTER_NAME, None) + self.assertTrue('=' not in tok) + + def test_token_sess(self): + generator = TokenGenerator(REGION, self._assuming_handler) + token = generator.get_token(CLUSTER_NAME, "RoleArn") + prefix = token[:len(TOKEN_PREFIX)] + self.assertEqual(prefix, TOKEN_PREFIX) + token_no_prefix = token[len(TOKEN_PREFIX):] + + decrypted_token = base64.urlsafe_b64decode( + token_no_prefix.encode() + ).decode() + self.assert_url_correct(decrypted_token, True) diff --git a/tests/unit/customizations/eks/test_update_kubeconfig.py b/tests/unit/customizations/eks/test_update_kubeconfig.py index 97647328b702..58c2155929c8 100644 --- a/tests/unit/customizations/eks/test_update_kubeconfig.py +++ b/tests/unit/customizations/eks/test_update_kubeconfig.py @@ -25,8 +25,7 @@ import awscli.customizations.eks.kubeconfig as kubeconfig from awscli.customizations.eks.update_kubeconfig import (KubeconfigSelector, EKSClient, - API_VERSION, - AUTH_BIN) + API_VERSION) from awscli.customizations.eks.exceptions import (EKSError, EKSClusterError) from awscli.customizations.eks.ordered_yaml import ordered_yaml_load @@ -54,8 +53,6 @@ def generate_env_variable(files): EXAMPLE_ARN = "arn:aws:eks:region:111222333444:cluster/ExampleCluster" -is_windows = sys.platform == 'win32' - class TestKubeconfigSelector(unittest.TestCase): def setUp(self): @@ -162,9 +159,6 @@ def test_arg_override_first_corrupted(self): class TestEKSClient(unittest.TestCase): def setUp(self): - executable = AUTH_BIN - if is_windows: - executable = AUTH_BIN + ".exe" self._correct_cluster_entry = OrderedDict([ ("cluster", OrderedDict([ ("certificate-authority-data", describe_cluster_response()\ @@ -180,11 +174,14 @@ def setUp(self): ("apiVersion", API_VERSION), ("args", [ - "token", - "-i", + "--region", + "region", + "eks", + "get-token", + "--cluster-name", "ExampleCluster" ]), - ("command", executable) + ("command", "aws") ])) ])) ]) diff --git a/tests/unit/customizations/test_s3uploader.py b/tests/unit/customizations/test_s3uploader.py index 0e6f892dc6f9..f80aaf46c03d 100644 --- a/tests/unit/customizations/test_s3uploader.py +++ b/tests/unit/customizations/test_s3uploader.py @@ -25,6 +25,7 @@ from botocore.stub import Stubber from s3transfer import S3Transfer +from awscli.compat import OrderedDict from awscli.testutils import unittest from awscli.customizations.s3uploader import S3Uploader from awscli.customizations.s3uploader import NoSuchBucketError @@ -33,17 +34,19 @@ class TestS3Uploader(unittest.TestCase): def setUp(self): + self._construct_uploader("us-east-1") + + def _construct_uploader(self, region): self.s3client = botocore.session.get_session().create_client( - 's3', region_name="us-east-1") + 's3', region_name=region) self.s3client_stub = Stubber(self.s3client) self.transfer_manager_mock = Mock(spec=S3Transfer) self.transfer_manager_mock.upload = Mock() self.bucket_name = "bucketname" self.prefix = None - self.region = "us-east-1" self.s3uploader = S3Uploader( - self.s3client, self.bucket_name, self.region, self.prefix, None, False, + self.s3client, self.bucket_name, self.prefix, None, False, self.transfer_manager_mock) @patch('os.path.getsize', return_value=1) @@ -54,7 +57,7 @@ def test_upload_successful(self, progress_percentage_mock, get_size_patch): prefix = "SomePrefix" remote_path_with_prefix = "{0}/{1}".format(prefix, remote_path) s3uploader = S3Uploader( - self.s3client, self.bucket_name, self.region, prefix, None, False, + self.s3client, self.bucket_name, prefix, None, False, self.transfer_manager_mock) expected_upload_url = "s3://{0}/{1}/{2}".format( self.bucket_name, prefix, remote_path) @@ -80,6 +83,40 @@ def test_upload_successful(self, progress_percentage_mock, get_size_patch): expected_extra_args, mock.ANY) s3uploader.file_exists.assert_called_once_with(remote_path_with_prefix) + @patch('os.path.getsize', return_value=1) + @patch("awscli.customizations.s3uploader.ProgressPercentage") + def test_upload_successful_odict(self, progress_percentage_mock, get_size_patch): + file_name = "filename" + remote_path = "remotepath" + prefix = "SomePrefix" + remote_path_with_prefix = "{0}/{1}".format(prefix, remote_path) + s3uploader = S3Uploader( + self.s3client, self.bucket_name, prefix, None, False, + self.transfer_manager_mock) + expected_upload_url = "s3://{0}/{1}/{2}".format( + self.bucket_name, prefix, remote_path) + + # Setup mock to fake that file does not exist + s3uploader.file_exists = Mock() + s3uploader.file_exists.return_value = False + # set the metadata used by the uploader when uploading + artifact_metadata = OrderedDict({"key": "val"}) + s3uploader.artifact_metadata = artifact_metadata + + upload_url = s3uploader.upload(file_name, remote_path) + self.assertEquals(expected_upload_url, upload_url) + + expected_extra_args = { + # expected encryption args + "ServerSideEncryption": "AES256", + # expected metadata + "Metadata": artifact_metadata + } + self.transfer_manager_mock.upload.assert_called_once_with( + file_name, self.bucket_name, remote_path_with_prefix, + expected_extra_args, mock.ANY) + s3uploader.file_exists.assert_called_once_with(remote_path_with_prefix) + @patch("awscli.customizations.s3uploader.ProgressPercentage") def test_upload_idempotency(self, progress_percentage_mock): file_name = "filename" @@ -104,7 +141,7 @@ def test_upload_force_upload(self, progress_percentage_mock, get_size_patch): # Set ForceUpload = True self.s3uploader = S3Uploader( - self.s3client, self.bucket_name, self.region, self.prefix, + self.s3client, self.bucket_name, self.prefix, None, True, self.transfer_manager_mock) # Pretend file already exists @@ -135,7 +172,7 @@ def test_upload_successful_custom_kms_key(self, progress_percentage_mock, get_si remote_path) # Set KMS Key Id self.s3uploader = S3Uploader( - self.s3client, self.bucket_name, self.region, self.prefix, + self.s3client, self.bucket_name, self.prefix, kms_key_id, False, self.transfer_manager_mock) # Setup mock to fake that file does not exist @@ -243,7 +280,7 @@ def test_file_exists(self): # Let's pretend some other unknown exception happened s3mock = Mock() - uploader = S3Uploader(s3mock, self.bucket_name, self.region) + uploader = S3Uploader(s3mock, self.bucket_name) s3mock.head_object = Mock() s3mock.head_object.side_effect = RuntimeError() @@ -278,8 +315,9 @@ def test_to_path_style_s3_url_us_east_1(self): key = "path/to/file" version = "someversion" region = "us-east-1" + self._construct_uploader(region) - s3uploader = S3Uploader(self.s3client, self.bucket_name, region) + s3uploader = S3Uploader(self.s3client, self.bucket_name) result = s3uploader.to_path_style_s3_url(key, version) self.assertEqual( result, @@ -298,12 +336,35 @@ def test_to_path_style_s3_url_other_regions(self): key = "path/to/file" version = "someversion" region = "us-west-2" + self._construct_uploader(region) + + s3uploader = S3Uploader(self.s3client, self.bucket_name, region) + result = s3uploader.to_path_style_s3_url(key, version) + self.assertEqual( + result, + "https://s3.{0}.amazonaws.com/{1}/{2}?versionId={3}".format( + region, self.bucket_name, key, version)) + + # Without versionId, that query parameter should be omitted + s3uploader = S3Uploader(self.s3client, self.bucket_name, region) + result = s3uploader.to_path_style_s3_url(key) + self.assertEqual( + result, + "https://s3.{0}.amazonaws.com/{1}/{2}".format( + region, self.bucket_name, key)) + + + def test_to_path_style_s3_url_china_regions(self): + key = "path/to/file" + version = "someversion" + region = "cn-northwest-1" + self._construct_uploader(region) s3uploader = S3Uploader(self.s3client, self.bucket_name, region) result = s3uploader.to_path_style_s3_url(key, version) self.assertEqual( result, - "https://s3-{0}.amazonaws.com/{1}/{2}?versionId={3}".format( + "https://s3.{0}.amazonaws.com.cn/{1}/{2}?versionId={3}".format( region, self.bucket_name, key, version)) # Without versionId, that query parameter should be omitted @@ -311,13 +372,13 @@ def test_to_path_style_s3_url_other_regions(self): result = s3uploader.to_path_style_s3_url(key) self.assertEqual( result, - "https://s3-{0}.amazonaws.com/{1}/{2}".format( + "https://s3.{0}.amazonaws.com.cn/{1}/{2}".format( region, self.bucket_name, key)) def test_artifact_metadata_invalid_type(self): prefix = "SomePrefix" s3uploader = S3Uploader( - self.s3client, self.bucket_name, self.region, prefix, None, False, + self.s3client, self.bucket_name, prefix, None, False, self.transfer_manager_mock) invalid_metadata = ["key", "val"] with self.assertRaises(TypeError): diff --git a/tests/unit/output/test_text_output.py b/tests/unit/output/test_text_output.py index d19a1f173098..c4f78379c9eb 100644 --- a/tests/unit/output/test_text_output.py +++ b/tests/unit/output/test_text_output.py @@ -77,6 +77,70 @@ def test_text_response(self): 'ENGINEDEFAULTS\tNone\n') +class TestDescribeChangesets(BaseAWSCommandParamsTest): + + def setUp(self): + super(TestDescribeChangesets, self).setUp() + self.first_parsed_response = { + 'Capabilities': ['CAPABILITY_IAM'], + 'ChangeSetId': ( + 'arn:aws:cloudformation:us-west-2:12345:changeSet' + '/mychangeset/12345' + ), + 'ChangeSetName': 'mychangeset', + 'Changes': [{"ChangeId": "1"}], + 'CreationTime': '2019-04-08T14:21:53.765Z', + 'ExecutionStatus': 'AVAILABLE', + 'NotificationARNs': [], + 'RollbackConfiguration': {'RollbackTriggers': []}, + 'StackId': ( + 'arn:aws:cloudformation:us-west-2:12345:stack' + '/MyStack/12345' + ), + 'StackName': 'MyStack', + 'Status': 'CREATE_COMPLETE', + 'NextToken': "more stuff" + } + self.second_parsed_response = { + 'Capabilities': ['CAPABILITY_IAM'], + 'ChangeSetId': ( + 'arn:aws:cloudformation:us-west-2:12345:changeSet' + '/mychangeset/12345' + ), + 'ChangeSetName': 'mychangeset', + 'Changes': [{"ChangeId": "2"}], + 'CreationTime': '2019-04-08T14:21:53.765Z', + 'ExecutionStatus': 'AVAILABLE', + 'NotificationARNs': [], + 'RollbackConfiguration': {'RollbackTriggers': []}, + 'StackId': ( + 'arn:aws:cloudformation:us-west-2:12345:stack' + '/MyStack/12345' + ), + 'StackName': 'MyStack', + 'Status': 'CREATE_COMPLETE' + } + self.parsed_responses = [ + self.first_parsed_response, + self.second_parsed_response, + ] + + def test_non_aggregate_keys(self): + output = self.run_cmd( + ('cloudformation describe-change-set --change-set-name mychangeset' + ' --stack-name MyStack --output text'), + expected_rc=0 + )[0] + self.assertEqual( + output, + ("arn:aws:cloudformation:us-west-2:12345:changeSet/mychangeset/" + "12345\tmychangeset\t2019-04-08T14:21:53.765Z\tNone\tAVAILABLE" + "\tNone\tarn:aws:cloudformation:us-west-2:12345:stack/MyStack" + "/12345\tMyStack\tCREATE_COMPLETE\tNone\tNone\n" + "CAPABILITIES\tCAPABILITY_IAM\nCHANGES\t1\nCHANGES\t2\n") + ) + + class CustomFormatter(Formatter): def __call__(self, operation, response, stream=None): self.stream = self._get_default_stream()