Link to home
Start Free TrialLog in
Avatar of Mikex13
Mikex13

asked on

Can't get list of AWS instances

I'm trying to get a list of all my AWS instances but so far no luck.

$client=[Amazon.AWSClientFactory]::CreateAmazonEC2Client($Access,$Secret)
$request = New-Object Amazon.EC2.Model.DescribeInstancesRequest
$response = $client.DescribeInstances($request)

but $response doesn't contain any data to work with. If I do  $response.DescribeInstancesResult, I get an empty result.
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

$client = [Amazon.AWSClientFactory]::CreateAmazonEC2Client($Access,$Secret)
$startReq = New-Object amazon.EC2.Model.StartInstancesRequest
$startReq.InstanceId.Add($instanceID);
$startResponse = $client.StartInstances($startReq)
$startResult = $startResponse.StartInstancesResult;
$startResult

Open in new window

Avatar of Mikex13
Mikex13

ASKER

#Sedgwick: Looking at your code, that starts an instance with a given instance ID. But what I'm after is the step before that: get a list of all instances.
Ok let me check
SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mikex13

ASKER

Done some more research, looking at AWS SDKs and noticed the "region" parameter which I or previous posters have not mentioned before. Adding that parameter fixed my issue.