AWS Tools for Windows PowerShell
Command Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Synopsis

Calls the Amazon Elastic Compute Cloud (EC2) DescribeImages API operation.

Syntax

Get-EC2Image
-ImageId <String[]>
-Owner <String[]>
-ExecutableUser <String[]>
-Filter <Filter[]>
-IncludeDeprecated <Boolean>
-IncludeDisabled <Boolean>
-MaxResult <Int32>
-NextToken <String>
-Select <String>
-PassThru <SwitchParameter>
-NoAutoIteration <SwitchParameter>
-ClientConfig <AmazonEC2Config>

Description

Describes the specified images (AMIs, AKIs, and ARIs) available to you or all of the images available to you. The images available to you include public images, private images that you own, and private images owned by other Amazon Web Services accounts for which you have explicit launch permissions. Recently deregistered images appear in the returned results for a short interval and then return empty results. After all instances that reference a deregistered AMI are terminated, specifying the ID of the image will eventually return an error indicating that the AMI ID cannot be found. We strongly recommend using only paginated requests. Unpaginated requests are susceptible to throttling and timeouts. The order of the elements in the response, including those within nested structures, might vary. Applications should not assume the elements appear in a particular order.

This cmdlet automatically pages all available results to the pipeline - parameters related to iteration are only needed if you want to manually control the paginated output. To disable autopagination, use -NoAutoIteration.

Parameters

-ClientConfig <AmazonEC2Config>
Amazon.PowerShell.Cmdlets.EC2.AmazonEC2ClientCmdlet.ClientConfig
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ExecutableUser <String[]>
Scopes the images by users with explicit launch permissions. Specify an Amazon Web Services account ID, self (the sender of the request), or all (public AMIs).
  • If you specify an Amazon Web Services account ID that is not your own, only AMIs shared with that specific Amazon Web Services account ID are returned. However, AMIs that are shared with the account’s organization or organizational unit (OU) are not returned.
  • If you specify self or your own Amazon Web Services account ID, AMIs shared with your account are returned. In addition, AMIs that are shared with the organization or OU of which you are member are also returned.
  • If you specify all, all public AMIs are returned.
Required?False
Position?3
Accept pipeline input?True (ByPropertyName)
AliasesExecutableBy, ExecutableUsers
-Filter <Filter[]>
The filters.
  • architecture - The image architecture (i386 | x86_64 | arm64 | x86_64_mac | arm64_mac).
  • block-device-mapping.delete-on-termination - A Boolean value that indicates whether the Amazon EBS volume is deleted on instance termination.
  • block-device-mapping.device-name - The device name specified in the block device mapping (for example, /dev/sdh or xvdh).
  • block-device-mapping.snapshot-id - The ID of the snapshot used for the Amazon EBS volume.
  • block-device-mapping.volume-size - The volume size of the Amazon EBS volume, in GiB.
  • block-device-mapping.volume-type - The volume type of the Amazon EBS volume (io1 | io2 | gp2 | gp3 | sc1 | st1 | standard).
  • block-device-mapping.encrypted - A Boolean that indicates whether the Amazon EBS volume is encrypted.
  • creation-date - The time when the image was created, in the ISO 8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ), for example, 2021-09-29T11:04:43.305Z. You can use a wildcard (*), for example, 2021-09-29T*, which matches an entire day.
  • description - The description of the image (provided during image creation).
  • ena-support - A Boolean that indicates whether enhanced networking with ENA is enabled.
  • hypervisor - The hypervisor type (ovm | xen).
  • image-id - The ID of the image.
  • image-type - The image type (machine | kernel | ramdisk).
  • is-public - A Boolean that indicates whether the image is public.
  • kernel-id - The kernel ID.
  • manifest-location - The location of the image manifest.
  • name - The name of the AMI (provided during image creation).
  • owner-alias - The owner alias (amazon | aws-marketplace). The valid aliases are defined in an Amazon-maintained list. This is not the Amazon Web Services account alias that can be set using the IAM console. We recommend that you use the Owner request parameter instead of this filter.
  • owner-id - The Amazon Web Services account ID of the owner. We recommend that you use the Owner request parameter instead of this filter.
  • platform - The platform. The only supported value is windows.
  • product-code - The product code.
  • product-code.type - The type of the product code (marketplace).
  • ramdisk-id - The RAM disk ID.
  • root-device-name - The device name of the root device volume (for example, /dev/sda1).
  • root-device-type - The type of the root device volume (ebs | instance-store).
  • source-instance-id - The ID of the instance that the AMI was created from if the AMI was created using CreateImage. This filter is applicable only if the AMI was created using CreateImage.
  • state - The state of the image (available | pending | failed).
  • state-reason-code - The reason code for the state change.
  • state-reason-message - The message for the state change.
  • sriov-net-support - A value of simple indicates that enhanced networking with the Intel 82599 VF interface is enabled.
  • tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value.
  • tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.
  • virtualization-type - The virtualization type (paravirtual | hvm).
Required?False
Position?4
Accept pipeline input?True (ByPropertyName)
AliasesFilters
-ImageId <String[]>
The image IDs.Default: Describes all images available to you.
Required?False
Position?1
Accept pipeline input?True (ByValue, ByPropertyName)
AliasesImageIds
-IncludeDeprecated <Boolean>
Specifies whether to include deprecated AMIs.Default: No deprecated AMIs are included in the response.If you are the AMI owner, all deprecated AMIs appear in the response regardless of what you specify for this parameter.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-IncludeDisabled <Boolean>
Specifies whether to include disabled AMIs.Default: No disabled AMIs are included in the response.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-MaxResult <Int32>
The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesMaxResults
-NextToken <String>
The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.
Note: This parameter is only used if you are manually controlling output pagination of the service API call.
In order to manually control output pagination, use '-NextToken $null' for the first call and '-NextToken $AWSHistory.LastServiceResponse.NextToken' for subsequent calls.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-NoAutoIteration <SwitchParameter>
By default the cmdlet will auto-iterate and retrieve all results to the pipeline by performing multiple service calls. If set, the cmdlet will retrieve only the next 'page' of results using the value of NextToken as the start point.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Owner <String[]>
Scopes the results to images with the specified owners. You can specify a combination of Amazon Web Services account IDs, self, amazon, and aws-marketplace. If you omit this parameter, the results include all images for which you have launch permissions, regardless of ownership.
Required?False
Position?2
Accept pipeline input?True (ByPropertyName)
AliasesOwners
-PassThru <SwitchParameter>
Changes the cmdlet behavior to return the value passed to the ImageId parameter. The -PassThru parameter is deprecated, use -Select '^ImageId' instead. This parameter will be removed in a future version.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Select <String>
Use the -Select parameter to control the cmdlet output. The default value is 'Images'. Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.EC2.Model.DescribeImagesResponse). Specifying the name of a property of type Amazon.EC2.Model.DescribeImagesResponse will result in that property being returned. Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)

Common Credential and Region Parameters

-AccessKey <String>
The AWS access key for the user account. This can be a temporary access key if the corresponding session token is supplied to the -SessionToken parameter.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesAK
-Credential <AWSCredentials>
An AWSCredentials object instance containing access and secret key information, and optionally a token for session-based credentials.
Required?False
Position?Named
Accept pipeline input?True (ByValue, ByPropertyName)
-EndpointUrl <String>
The endpoint to make the call against.Note: This parameter is primarily for internal AWS use and is not required/should not be specified for normal usage. The cmdlets normally determine which endpoint to call based on the region specified to the -Region parameter or set as default in the shell (via Set-DefaultAWSRegion). Only specify this parameter if you must direct the call to a specific custom endpoint.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-NetworkCredential <PSCredential>
Used with SAML-based authentication when ProfileName references a SAML role profile. Contains the network credentials to be supplied during authentication with the configured identity provider's endpoint. This parameter is not required if the user's default network identity can or should be used during authentication.
Required?False
Position?Named
Accept pipeline input?True (ByValue, ByPropertyName)
-ProfileLocation <String>
Used to specify the name and location of the ini-format credential file (shared with the AWS CLI and other AWS SDKs)If this optional parameter is omitted this cmdlet will search the encrypted credential file used by the AWS SDK for .NET and AWS Toolkit for Visual Studio first. If the profile is not found then the cmdlet will search in the ini-format credential file at the default location: (user's home directory)\.aws\credentials.If this parameter is specified then this cmdlet will only search the ini-format credential file at the location given.As the current folder can vary in a shell or during script execution it is advised that you use specify a fully qualified path instead of a relative path.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesAWSProfilesLocation, ProfilesLocation
-ProfileName <String>
The user-defined name of an AWS credentials or SAML-based role profile containing credential information. The profile is expected to be found in the secure credential file shared with the AWS SDK for .NET and AWS Toolkit for Visual Studio. You can also specify the name of a profile stored in the .ini-format credential file used with the AWS CLI and other AWS SDKs.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesStoredCredentials, AWSProfileName
-Region <Object>
The system name of an AWS region or an AWSRegion instance. This governs the endpoint that will be used when calling service operations. Note that the AWS resources referenced in a call are usually region-specific.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRegionToCall
-SecretKey <String>
The AWS secret key for the user account. This can be a temporary secret key if the corresponding session token is supplied to the -SessionToken parameter.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesSK, SecretAccessKey
-SessionToken <String>
The session token if the access and secret keys are temporary session-based credentials.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesST

Outputs

This cmdlet returns a collection of Amazon.EC2.Model.Image objects. The service call response (type Amazon.EC2.Model.DescribeImagesResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack.

Examples

Example 1

Get-EC2Image -ImageId ami-12345678

Architecture : x86_64
BlockDeviceMappings : {/dev/xvda}
CreationDate : 2014-10-20T00:56:28.000Z
Description : My image
Hypervisor : xen
ImageId : ami-12345678
ImageLocation : 123456789012/my-image
ImageOwnerAlias :
ImageType : machine
KernelId :
Name : my-image
OwnerId : 123456789012
Platform :
ProductCodes : {}
Public : False
RamdiskId :
RootDeviceName : /dev/xvda
RootDeviceType : ebs
SriovNetSupport : simple
State : available
StateReason :
Tags : {Name}
VirtualizationType : hvm
This example describes the specified AMI.

Example 2

Get-EC2Image -owner self
This example describes the AMIs that you own.

Example 3

Get-EC2Image -Filter @{ Name="platform"; Values="windows" }
This example describes the public AMIs that run Microsoft Windows Server.

Example 4

Get-EC2Image -Region us-west-2
This example describes all public AMIs in the 'us-west-2' region.

Supported Version

AWS Tools for PowerShell: 2.x.y.z