How to create a PowerShell Script to start an EC2 instance and capture public IP?

0

I would like to create a PowerShell Script that performs the following steps:

1 - Start an EC2 Instance in AWS (Windows);

2 - Wait for it to be available for remote connection. While waiting, display a message waiting for the user;

3 - As soon as it is available, get Public IP (which will be random);

4 - Start Remote Desktop to capture this Instance using this IP;

Steps 1 and 4 I have already achieved, but the ones I have the most difficulties are steps 2 and 3. I have already looked here in Stackoverflow and I have not found either.

If anyone has any ideas, I would be very grateful.

Hugs

    
asked by anonymous 24.11.2017 / 15:45

1 answer

0

For step 2 you can use the wait commands, such as aws ec2 wait instance-status-ok --instance-ids i-xxxxxxxx (use --query in step 1 to capture the instance id): link

To step 3: link

    
12.12.2017 / 11:35