2

I am trying out AWS Powershell tool. What is the command to load AMI image I created in my environment? Apparently get-ec2image command loads all the available image on the market, which is not what I want.

Anthony Neace
  • 25,013
  • 7
  • 114
  • 129
minisch
  • 323
  • 5
  • 19

2 Answers2

1

The detailed syntax of the Get-EC2Image is

Get-EC2Image-ImageId <String[]>-Owner <String[]>-ExecutableUser <String[]>-Filter <Filter[]>

So in your case it would workout to be, assuming 123456789 being your AWS Account Number.

Get-EC2Image -Owner '123456789'
Naveen Vijay
  • 15,928
  • 7
  • 71
  • 92
1

Get-EC2Image is what you need, you just need to set the -Owner parameter to 'self', like so:

PS C:/> Get-EC2Image -owner self

Here's an example where you can select your own AMIs, filtered by AMI Name (the AMI name given during image creation, not the re-assignable tag "name"):

PS C:/> Get-EC2Image -Owners self -Filters @{ Name='name'; Values='amiName' }

From the documentation:

In this context, [self] refers to the user who corresponds to the credentials with which the cmdlet is invoked.

More info available at the documentation for Get-EC2Image.

Anthony Neace
  • 25,013
  • 7
  • 114
  • 129
  • Thank you. How do I pick a particular image called "TestImage" from my list and launch a new instance from that image? and assign a static IP address if its possible?? :-/ – minisch Mar 26 '15 at 09:58
  • @minisch You should create a new question to ask these, comments on Stack Overflow are meant to be ephemeral whenever possible and are hard to use for answers because of formatting limitations. But generally, for using names you'll want to use the `-Filter` parameter (see example by typing `get-help get-ec2image -full` in powershell). For static IPs you'll want to read on [Elastic IPs](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html). – Anthony Neace Mar 26 '15 at 10:05
  • @minisch I've updated the answer to include an example of the name filter. – Anthony Neace Mar 26 '15 at 10:15