Advertisement
Javi

AWS: CLI for creating vpc

Dec 18th, 2018
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. OWNER=ciberadok8s
  2. VPC=$(aws ec2 create-vpc --cidr-block10.10.0.0/16 --query "Vpc.VpcId" --output text)
  3. aws ec2 create-tags --resources $VPC --tags "Key=Name,Value=$OWNER-vpc"
  4.  
  5. IGW=$(aws ec2 create-internet-gateway --query "InternetGateway.InternetGatewayId" --output text)
  6. aws ec2 create-tags --resources $IGW --tags "Key=Name,Value=$OWNER-vpc"
  7. aws ec2 attach-internet-gateway --internet-gateway-id $IGW --vpc-id $VPC
  8.  
  9. SUBNET=$(aws ec2 create-subnet --vpc-id $VPC --cidr-block 10.10.1.0/24 --query Subnet.SubnetId --output text)
  10. aws ec2 create-tags --resources $SUBNET --tags "Key=Name,Value=$OWNER-vpc"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement