View a markdown version of this page

Use DeregisterImage with a CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DeregisterImage with a CLI

The following code examples show how to use DeregisterImage.

CLI
AWS CLI

To deregister an AMI

The following deregister-image example deregisters the specified AMI.

aws ec2 deregister-image \ --image-id ami-4fa54026

Output:

{ "Return": true }

For more information, see Deregister an Amazon EC2 AMI in the Amazon EC2 User Guide.

PowerShell
Tools for PowerShell V4

Example 1: This example deregisters the specified AMI.

Unregister-EC2Image -ImageId ami-12345678
  • For API details, see DeregisterImage in AWS Tools for PowerShell Cmdlet Reference (V4).

Tools for PowerShell V5

Example 1: This example deregisters the specified AMI.

Unregister-EC2Image -ImageId ami-12345678
  • For API details, see DeregisterImage in AWS Tools for PowerShell Cmdlet Reference (V5).