-
-
Save optionalg/9dfdb6d9471b9897ab123d772450668d to your computer and use it in GitHub Desktop.
aws cliを使ってec2の複数を起動してセットアップしたり、落としたり。
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
| #!/bin/bash -eu | |
| instance_id=`aws ec2 run-instances --image-id ami-e251209a --security-group-ids sg-05a81e83dd2c1336a --count 1 --instance-type t2.micro --key-name awskey --query 'Instances[0].InstanceId'` | |
| echo $instance_id | |
| ip_address=`aws ec2 describe-instances --instance-ids $instance_id --query 'Reservations[0].Instances[0].PublicIpAddress'` | |
| echo $ip_address | |
| ssh -i 'c:/Users/umi/.ssh/awskey.pem' ec2-user@$ip_address | |
| # ssh -i 'c:/Users/umi/.ssh/awskey.pem' ec2-user@$ip_address 'bash -s' < /c/Users/umi/GoogleDrive/code/test2.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment