Last active
November 29, 2021 22:19
-
-
Save froop/b266d77dd8c229987cd27a4386d3fc98 to your computer and use it in GitHub Desktop.
[AWS][Windows] Start EC2 instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd %TEMP% | |
aws ec2 describe-instances --instance-ids %AWS_EC2_INSTANCE% --output text --query "Reservations[].Instances[].{PublicIp:PublicIpAddress}" > AWS_EC2_IP.txt | |
set /P TEMP_IP=<AWS_EC2_IP.txt | |
del AWS_EC2_IP.txt | |
setx AWS_EC2_IP %TEMP_IP% | |
pause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws ec2 start-instances --instance-ids %AWS_EC2_INSTANCE% && aws ec2 wait instance-running --instance-ids %AWS_EC2_INSTANCE% | |
pause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws ec2 stop-instances --instance-ids %AWS_EC2_INSTANCE% | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
update
[AWS][Windows] Launch EC2 instance from template
https://gist.github.com/froop/e2d231a02d6a7be8c2b337378da791ea