AWS AWSEC2 documentation change
Summary
Updated AMI disable/enable documentation with PowerShell examples, command syntax changes, and improved filtering examples
Security assessment
Changes focus on adding PowerShell support, clarifying command syntax, and improving AMI visibility filters. No evidence of addressing vulnerabilities or security incidents.
Diff
diff --git a/AWSEC2/latest/UserGuide/disable-an-ami.md b/AWSEC2/latest/UserGuide/disable-an-ami.md index ba90f0e83..f0850b5c9 100644 --- a//AWSEC2/latest/UserGuide/disable-an-ami.md +++ b//AWSEC2/latest/UserGuide/disable-an-ami.md @@ -74 +74 @@ Disabling an AMI removes all its launch permissions. -When you disable an AMI, the AMI is not deleted. If the AMI is an EBS-backed AMI, you continue to pay for the AMI's EBS snapshots. If you want to keep the AMI, you might be able to reduce your storage costs by archiving the snapshots. For more information, see [Archive Amazon EBS snapshots](https://docs.aws.amazon.com/ebs/latest/userguide/snapshot-archive.html) in the _Amazon EBS User Guide_. If you don't want to keep the AMI and its snapshots, you must deregister the AMI and delete the snapshots. For more information, see [EBS-backed AMIs](./deregister-ami.html#clean-up-ebs-ami). +When you disable an AMI, the AMI is not deleted. If the AMI is an EBS-backed AMI, you continue to pay for the AMI's EBS snapshots. If you want to keep the AMI, you might be able to reduce your storage costs by archiving the snapshots. For more information, see [Archive Amazon EBS snapshots](https://docs.aws.amazon.com/ebs/latest/userguide/snapshot-archive.html) in the _Amazon EBS User Guide_. If you don't want to keep the AMI and its snapshots, you must deregister the AMI and delete the snapshots. For more information, see [Deregister an AMI](./deregister-ami.html). @@ -118 +118 @@ AWS CLI -Use the [disable-image](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/disable-image.html) command and specify the ID of the AMI. +Use the following [disable-image](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/disable-image.html) command. @@ -121 +121 @@ Use the [disable-image](https://awscli.amazonaws.com/v2/documentation/api/latest - aws ec2 disable-image --image-id ami-1234567890abcdef0 + aws ec2 disable-image --image-id ami-0abcdef1234567890 @@ -123 +123,6 @@ Use the [disable-image](https://awscli.amazonaws.com/v2/documentation/api/latest -The following is example output. +PowerShell + + +###### To disable an AMI + +Use the following [Disable-EC2Image](https://docs.aws.amazon.com/powershell/latest/reference/items/Disable-EC2Image.html) cmdlet. @@ -126,3 +131 @@ The following is example output. - { - "Return": "true" - } + Disable-EC2Image -ImageId ami-0abcdef1234567890 @@ -155 +158 @@ AWS CLI -By default, when you use the [describe-images](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-images.html) command to describe all AMIs, disabled AMIs do not appear in the results. This is because the default is `--no-include-disabled`. To include disabled AMIs in the results, you must specify the `--include-disabled` parameter. +By default, when you describe all AMIs, the disabled AMIs are not included in the results. To include disabled AMIs in the results, specify the `--include-disabled` option. The `State` field for an AMI is `disabled` if the AMI is disabled. @@ -157 +160 @@ By default, when you use the [describe-images](https://awscli.amazonaws.com/v2/d -###### To include all disabled AMIs when describing all AMIs +###### To include disabled AMIs when describing all AMIs for an account @@ -159 +162 @@ By default, when you use the [describe-images](https://awscli.amazonaws.com/v2/d -Use the [describe-images](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-images.html) command and specify the `--include-disabled` parameter to retrieve disabled AMIs in addition to all other AMIs. Optionally, specify `--owners self` to retrieve only the AMIs that you own. +Use the following [describe-images](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-images.html) command. @@ -163,2 +166 @@ Use the [describe-images](https://awscli.amazonaws.com/v2/documentation/api/late - --region us-east-1 \ - --owners self + --owners 123456789012 \ @@ -167 +169,3 @@ Use the [describe-images](https://awscli.amazonaws.com/v2/documentation/api/late -If you specify the ID of a disabled AMI, but do not specify `--include-disabled`, the disabled AMI is returned in the results. +###### To list the disabled AMIs for your account + +Use the following [describe-images](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-images.html) command. @@ -171,2 +175,8 @@ If you specify the ID of a disabled AMI, but do not specify `--include-disabled` - --region us-east-1 \ - --image-ids ami-1234567890EXAMPLE + --owners self \ + --include-disabled \ + --filters Name=state,Values=disabled \ + --query Images[].ImageId \ + --output text + +The following is example output. + @@ -174 +184 @@ If you specify the ID of a disabled AMI, but do not specify `--include-disabled` -###### To retrieve only disabled AMIs + ami-0abcdef1234567890 @@ -176 +186,3 @@ If you specify the ID of a disabled AMI, but do not specify `--include-disabled` -Specify `--filters Name=state,Values=disabled`. You must also specify `--include-disabled`, otherwise you'll get an error. +###### To describe the status of an AMI + +Use the following [describe-images](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-images.html) command. If `DeprecationTime` is not present in the output, the AMI is not deprecated or set to deprecate at a future date. @@ -180,43 +192,39 @@ Specify `--filters Name=state,Values=disabled`. You must also specify `--include - --include-disabled \ - --filters Name=state,Values=disabled - -The following is example output. The `State` field displays the state of an AMI. `disabled` indicates that the AMI is disabled. - - - { - "Images": [ - { - "VirtualizationType": "hvm", - "Description": "Provided by Red Hat, Inc.", - "PlatformDetails": "Red Hat Enterprise Linux", - "EnaSupport": true, - "Hypervisor": "xen", - **"State": "disabled",** - "SriovNetSupport": "simple", - "ImageId": "ami-1234567890EXAMPLE", - "DeprecationTime": "2023-05-10T13:17:12.000Z" - "UsageOperation": "RunInstances:0010", - "BlockDeviceMappings": [ - { - "DeviceName": "/dev/sda1", - "Ebs": { - "SnapshotId": "snap-111222333444aaabb", - "DeleteOnTermination": true, - "VolumeType": "gp2", - "VolumeSize": 10, - "Encrypted": false - } - } - ], - "Architecture": "x86_64", - "ImageLocation": "123456789012/RHEL-8.0.0_HVM-20190618-x86_64-1-Hourly2-GP2", - "RootDeviceType": "ebs", - "OwnerId": "123456789012", - "RootDeviceName": "/dev/sda1", - "CreationDate": "2019-05-10T13:17:12.000Z", - "Public": false, - "ImageType": "machine", - "Name": "RHEL-8.0.0_HVM-20190618-x86_64-1-Hourly2-GP2" - } - ] - } + --image-ids ami-0abcdef1234567890 \ + --query Images[].State \ + --output text + +The following is example output. + + + disabled + +PowerShell + + +By default, when you describe all AMIs, the disabled AMIs are not included in the results. To include disabled AMIs in the results, specify the `-IncludeDisabled` parameter. The `State` field for an AMI is `disabled` if the AMI is disabled. + +###### To list the disabled AMIs for your account + +Use the following [Get-EC2Image](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2Image.html) cmdlet. + + + (Get-EC2Image ` + -Owner self ` + -IncludeDisabled $true | Where-Object {$_.State -eq "disabled"}).ImageId + +The following is example output. + + + ami-0abcdef1234567890 + +###### To describe the status of an AMI + +Use the following [Get-EC2Image](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2Image.html) cmdlet. + + + (Get-EC2Image -ImageId ami-0abcdef1234567890).State.Value + +The following is example output. + + + disabled @@ -251 +259 @@ AWS CLI -Use the [enable-image](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/enable-image.html) command and specify the ID of the AMI. +Use the following [enable-image](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/enable-image.html) command. @@ -254 +262 @@ Use the [enable-image](https://awscli.amazonaws.com/v2/documentation/api/latest/ - aws ec2 enable-image --image-id ami-1234567890abcdef0 + aws ec2 enable-image --image-id ami-0abcdef1234567890 @@ -256 +264,6 @@ Use the [enable-image](https://awscli.amazonaws.com/v2/documentation/api/latest/ -The following is example output. +PowerShell + + +###### To re-enable a disabled AMI + +Use the following [Enable-EC2Image](https://docs.aws.amazon.com/powershell/latest/reference/items/Enable-EC2Image.html) cmdlet. @@ -259,3 +272 @@ The following is example output. - { - "Return": "true" - } + Enable-EC2Image -ImageId ami-0abcdef1234567890