Skip to main content

Posts

Showing posts from September 12, 2018

AWS Command line script for creating basic VPC environment.

#!/bin/bash ################################### #Created on 27-Jun-2018 #Purpose : This script will Create a VPC/Subnet/Routetable/Internetgateway/Natgateway and associate them to the corresponding subnets #Modified on : 13-Sep-2018 #################################### vpcName="My-VPC" vpcCidrBlock="10.0.0.0/16" PubsubNetCidrBlock="10.0.1.0/24" PrvsubNetCidrBlock="10.0.2.0/24" pubAvailabilityZone="ap-northeast-1a" prvAvailabilityZone="ap-northeast-1c" pubSubnetName="PublicSubnet-My" prvSubnetName="PrivateSubnet-My" PubRouteTableName="MyPublicRoute" PrvRouteTableName="MyPrivateRoute" destinationCidrBlock="0.0.0.0/0" #Create a VPC with a 10.0.0.0/16 CIDR block. aws_response=$(aws ec2 create-vpc --cidr-block "$vpcCidrBlock" --output json) vpcId=$(echo -e "$aws_response" |  /usr/bin/jq '.Vpc.VpcId' | tr -d '"') #nam