Use DeregisterImage with an AWS SDK or CLI - AWS SDK Code Examples

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

Use DeregisterImage with an AWS SDK or CLI

The following code examples show how to use DeregisterImage.

CLI
AWS CLI

To deregister an AMI

This example deregisters the specified AMI. If the command succeeds, no output is returned.

Command:

aws ec2 deregister-image --image-id ami-4fa54026
PowerShell
Tools for PowerShell

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.