Created
December 11, 2012 20:38
-
-
Save j3tm0t0/4261940 to your computer and use it in GitHub Desktop.
oneliner to create VPC
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/zsh | |
| VPCID=$(ec2addvpc 10.100.0.0/16 | cut -f 2 ) && sleep 30 | SUBNETA=$(ec2addsubnet -c $VPCID -i 10.100.1.0/24 -z ap-northeast-1a| cut -f 2) && SUBNETB=$(ec2addsubnet -c $VPCID -i 10.100.2.0/24 -z ap-northeast-1b| cut -f 2) && IGW=$(ec2addigw | cut -f 2) && sleep 15 | ec2attigw $IGW -c $VPCID | RTB=$(ec2drtb | grep $VPCID | cut -f 2) | ec2assocrtb $RTB -s $SUBNETA | ec2addrt $RTB -r 0.0.0.0/0 -g $IGW | INSAID=$(ec2run ami-4e6cd34f -k keypair -t t1.micro -s $SUBNETA | grep ^INSTANCE | cut -f 2) && INSBID=$(ec2run ami-4e6cd34f -k keypair -t t1.micro -s $SUBNETB | grep ^INSTANCE | cut -f 2) && EIPASSOS=$(ec2allocaddr -d vpc | cut -f 5) && SG=$(ec2dgrp | grep $VPCID | cut -f 2) && ec2auth $SG -P TCP -p 22 | sleep 30 | ec2assocaddr -a $EIPASSOS -i $INSAID --allow-reassociation | echo DONE! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment