-
Notifications
You must be signed in to change notification settings - Fork 3
7._Getting_Started_ _Building
We've got a plan together, so now it's time to start building infrastructure.
To create our KeyPair, we're going to use the command:
awsm createKeyPair awsm us-east-1
This will create (import) the previously generated KeyPair named awsm
in us-east-1
, the output should look similar to this:
$ awsm createKeyPair us-east-1
✓ Found KeyPair class configuration for [awsm]!
△ Created public key named [awsm] in [us-east-1]!
To create our VPC, we're going to use the command:
awsm createVpc awsm awsm-vpc 10.1.0.0 us-east-1
This will create a new VPC named awsm-vpc
with the CIDR IP range of 10.1.0.0/16 in us-east-1
, the output should look similar to this:
$ awsm createVpc awsm awsm-vpc 10.1.0.0 us-east-1
✓ Found VPC Class Configuration for [awsm]!
△ Created VPC [vpc-d75db8ae] named [awsm-vpc] in [us-east-1]!
To create our Public Subnet, we're going to use the command:
awsm createSubnet public awsm-public awsm-vpc 10.1.1.0 us-east-1a
This will create a new Subnet named awsm-public
with the CIDR IP range of 10.1.1.0/24 in the awsm-vpc
VPC.
It also creates an Internet Gateway, a NAT Gateway with an Elastic IP, and new Route Table.
The output should look similar to this:
$ awsm createSubnet public awsm-public awsm-vpc 10.1.1.0 us-east-1a
✓ Found Subnet Class Configuration for [public]!
✓ Found VPC [vpc-d144a4a8] named [awsm-vpc] with a class of [awsm] in [us-east-1]!
△ Created Subnet [subnet-63173406] named [awsm-public] in [us-east-1]!
▶ Waiting to tag Subnet...
△ Adding Subnet Tags...
▶ Creating a new Internet Gateway...
△ Created VPC Internet Gateway [igw-1272ab74] named [awsm-vpc-internet-gateway] in [us-east-1]!
△ Adding Internet Gateway Tags...
▶ Attaching Internet Gateway to VPC...
△ Attached Internet Gateway [igw-1272ab74] to VPC [vpc-d144a4a8]!
▶ Creating a new Route Table...
△ Created VPC Route Table [rtb-8003ebf8] named [awsm-vpc-awsm-public-route-table] in [us-east-1]!
▶ Associating Route Table to Subnet...
△ Associated Route Table [rtb-8003ebf8] to Subnet [subnet-63173406] !
▶ Adding Internet Gateway to New Route Table...
△ Added route to [rtb-8003ebf8]!
▶ Creating a new NAT Gateway...
△ Created Address [34.239.229.218] with allocation Id [eipalloc-65073554] in [us-east-1]!
△ Created VPC NAT Gateway [nat-08e2c09e999caeffe] named [awsm-vpc-nat-gateway] in [us-east-1]!
▶ Waiting until the NAT Gateway is available...
▶ Adding NAT Gateway to Main Route Table...
△ Added route to [rtb-7abd5402]!
✓ Done!
To create our Subnet, we're going to use the command:
awsm createSubnet private awsm-private awsm-vpc 10.1.2.0 us-east-1a
This will create a new Subnet named awsm-private
with the CIDR IP range of 10.1.2.0/24 in the awsm-vpc
VPC, the output should look similar to this:
$ awsm createSubnet private awsm-private awsm-vpc 10.1.2.0 us-east-1a
✓ Found Subnet Class Configuration for [private]!
✓ Found VPC [vpc-d144a4a8] named [awsm-vpc] with a class of [awsm] in [us-east-1]!
△ Created Subnet [subnet-580c2f3d] named [awsm-private] in [us-east-1a]!
▶ Waiting to tag Subnet...
△ Adding Subnet Tags...
✓ Done!
To create our Security Group, we're going to use the command:
awsm createSecurityGroup dev us-east-1 awsm-vpc
This will create a new Security Group named dev
in the awsm-vpc
VPC, the output should look similar to this:
$ awsm createSecurityGroup dev us-east-1 awsm-vpc
✓ Found Security Group class configuration for [dev]
✓ Found VPC [vpc-d144a4a8] named [awsm-vpc] in [us-east-1]
△ Created Security Group [sg-cdb772b3] in region [us-east-1a]
△ Comparing awsm Security Group grants...
✓ Comparison complete!
To launch our EC2 Instance, we're going to use the command:
awsm launchInstance hello-world 1 us-east-1a
This will create a new Security Group named dev
in the awsm-vpc
VPC, the output should look similar to this:
$ awsm launchInstance hello-world 1 us-east-1a
✓ Found Instance class configuration for [hello-world]!
✓ Found Availability Zone [us-east-1b]!
▶ There is no AMI class configured for this Instance class, please provide an AMI to use:
◀ ami-e4139df2
✓ Found AMI [ami-e4139df2] with name [ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20170330-d83d0782-cb94-46d7-8993-f4ce15d1a484-ami-4dd2575b.4] created [3 weeks ago]!
✓ Found KeyPair [awsm] in [us-east-1]!
✓ Found VPC [vpc-d144a4a8] in Region [us-east-1]!
✓ Found Subnet [subnet-580c2f3d] in VPC [vpc-d144a4a8]!
✓ Found VPC Security Group [sg-cdb772b3] with name [dev]!
△ Launching Instance:
+--------------+-------------+------------+-----------+---------------------+--------------+------+---------+---------+---------+-------------------+----------+-------------+----------------------+
| NAME | CLASS | PRIVATE IP | PUBLIC IP | INSTANCE ID | AMI | ROOT | SIZE | STATE | KEYPAIR | AVAILABILITY ZONE | VPC | SUBNET | IAM INSTANCE PROFILE |
+--------------+-------------+------------+-----------+---------------------+--------------+------+---------+---------+---------+-------------------+----------+-------------+----------------------+
| hello-world1 | hello-world | 10.1.1.127 | | i-04bd1f40fa93d34f9 | ami-e4139df2 | ebs | t2.nano | pending | awsm | us-east-1a | awsm-vpc | awsm-public | |
+--------------+-------------+------------+-----------+---------------------+--------------+------+---------+---------+---------+-------------------+----------+-------------+----------------------+
▶ Waiting to tag Instance...
△ Adding EC2 Tags...
✓ Finished Launching Instance!
Note: The
hello-world
Instance Class does not have an AMI configured by default. In this example above, we are prompted for an AMI and have entered the ID for an Ubuntu 16.04 LTS AMI available on the AWS Marketplace.
As you can tell from the output from the last command, our server launched with a private private IP, but our hello-world Class configuration specified that we wanted the instance to have a Public IP also. To get the IP address that was assigned to our newly created instances we can run the command:
awsm listInstances hello-world
This will query AWS and return any EC2 instances that match the search term "hello-world"
The output should look similar to this:
$ awsm listInstances hello-world
+--------------+-------------+------------+----------------+---------------------+--------------+------+---------+---------+---------+-------------------+----------+-------------+----------------------+
| NAME | CLASS | PRIVATE IP | PUBLIC IP | INSTANCE ID | AMI | ROOT | SIZE | STATE | KEYPAIR | AVAILABILITY ZONE | VPC | SUBNET | IAM INSTANCE PROFILE |
+--------------+-------------+------------+----------------+---------------------+--------------+------+---------+---------+---------+-------------------+----------+-------------+----------------------+
| hello-world1 | hello-world | 10.1.1.127 | 34.200.246.176 | i-04bd1f40fa93d34f9 | ami-e4139df2 | ebs | t2.nano | running | awsm | us-east-1a | awsm-vpc | awsm-public | |
+--------------+-------------+------------+----------------+---------------------+--------------+------+---------+---------+---------+-------------------+----------+-------------+----------------------+
Once the Instance finishes configuring, we should be able to load its public IP address in our browser...
Check out of the rest of the documentation, which includes usage information and examples of each of the available awsm
commands.