1) **** Script to get a list of hosts from AWS for a Particular Region
#!/bin/bash
source /Users/name/ec2/bashrc_prod_east
ec2-describe-instances |grep Name |grep -v aws:autoscaling:groupName |awk '{print $5}'
$count='wc -l';
echo "Total $count hosts found on Prod East"
2) Launch an Instance :
bash$ ec2-run-instances ami-76817c1e -k sunfod-dev-us-east-1-general --instance-type t2.small -s subnet-058d0a6b
RESERVATION r-f39fd8 1500819717
INSTANCE i-12d47f9 ami-7817c1e ip-10-224-12-98.ec2.internal pending sunfod-dev-us-east-1-general 0 t2.small 2014-09-11T03:39:36+0000 us-east-1c monitoring-disabled 10.224.12.18 vpc-9d1f9bf3 subnet-058d0a6b ebs hvm xen sg-34da035b default false
NIC eni-3ac6764c subnet-058d0a6b vpc-9d1f9bf3 150081971781 in-use 10.224.12.18 ip-10-224-12-18.ec2.internal true
NICATTACHMENT eni-attach-34284b57 0 attaching 2014-09-10T23:39:36-0400 true
GROUP sg-34da035b default
PRIVATEIPADDRESS 10.224.12.18 ip-10-224-12-18.ec2.internal
bash$
3) Set up hostnames using ec2-create-tags:
bash$ ec2-create-tags ami-76817c1e i-12d47af9 --tag "Name=YourHostname"
4) Add Security Groups from AWS console or need to check command line options for that.
#!/bin/bash
source /Users/name/ec2/bashrc_prod_east
ec2-describe-instances |grep Name |grep -v aws:autoscaling:groupName |awk '{print $5}'
$count='wc -l';
echo "Total $count hosts found on Prod East"
2) Launch an Instance :
bash$ ec2-run-instances ami-76817c1e -k sunfod-dev-us-east-1-general --instance-type t2.small -s subnet-058d0a6b
RESERVATION r-f39fd8 1500819717
INSTANCE i-12d47f9 ami-7817c1e ip-10-224-12-98.ec2.internal pending sunfod-dev-us-east-1-general 0 t2.small 2014-09-11T03:39:36+0000 us-east-1c monitoring-disabled 10.224.12.18 vpc-9d1f9bf3 subnet-058d0a6b ebs hvm xen sg-34da035b default false
NIC eni-3ac6764c subnet-058d0a6b vpc-9d1f9bf3 150081971781 in-use 10.224.12.18 ip-10-224-12-18.ec2.internal true
NICATTACHMENT eni-attach-34284b57 0 attaching 2014-09-10T23:39:36-0400 true
GROUP sg-34da035b default
PRIVATEIPADDRESS 10.224.12.18 ip-10-224-12-18.ec2.internal
bash$
3) Set up hostnames using ec2-create-tags:
bash$ ec2-create-tags ami-76817c1e i-12d47af9 --tag "Name=YourHostname"
4) Add Security Groups from AWS console or need to check command line options for that.