Kibria's Portfolio

Creating a DevOps Environment

These are the steps I took to create secure and scalable infrastructure:

1. AWS VPC to create the virtual environment.

2. AWS Internet Gateway to create a secure route to the internet.

3. Route Table to direct the network traffic.

4. Associate that route table with the subnet.

5. Created a Security Group open to HTTP traffic.

6. Created AWS EC2 Instance as my virtual server.

Why the Project was built?

As I have a strong passion for tech  and specifically cloud technology, I realise IaC plays a pivotal role in the
cloud computing sector. Terraform has the capability of saving time and money for businesses due to its highly
scalable ability. This project helped me understand why Terraform is widely used and the benefits it brings in a real life setting.

First I created an access and security keys on my AWS account to connect my VS Code Terraform to my AWS account using CLI.

After installing CLI, I run configurations on my windows cmd and connected my AWS account.
I set my output format JSON and location for AWS using access key I created.

I ran Terraform.init which is downloading the latest version of hashicorp/aws and installing that provider.
The green writing is always a good thing which means it initialised correctly.

Once successfully initialised, it has created relevant folders which I will configure to suit
a developer environment where changes can be made easily, adding and removing resources at scale.

This is where I access the relevant coding to add new resources. This is the terraform aws documentation
section of the Hashicorp website. The image above shows the instructions to add an EC2 instance
to my project.

So, I have declared the ami,  instance type: t2 micro and added a tag with a name
to refer to this EC2 later fpr scaling purposes.

After I set up my resources, I entered terraform apply in the terminal. This then returned the image above, which
shows a plan for what resources are about to be added, indicated by the green plus mark. After checking everything
I entered yes in the terminal to begin adding the resources.

After confirming terraform apply, it has created a tf state file as can be seen above.
This is showing all the resources that form the entire infrastructure. So any changes made
elsewhere, it will compare it to this state file and make changes accordingly.

Now after checking my AWS account I can see it has created the
EC2 instance after applying it via terraform and the instance state is showing as “Running”.

To increase the scalability of my infrastructure, I have created a variables file using Terraform.
Without this approach, it would require me to filter through the main file and find the resources
I want to make changes to, which will take time. Once variables are created, I can use terraform apply
to only make changes to a specific resource by declaring it using -var and add the resource name.

The above image shows my whole networking and infrastructure which consists of:
1. VPC – Secure private network 2. Subnet for that VPC connected via the ID
3. Internet Gateway – which is my route to the internet

4. Route Table created with the IGW routem 5. Associated that route table with the subnet
6. Created new Security Group open to http traffic
6. Created an EC2 Instance

So if this code is saved it can be re-used to create whole infrastructures in
few seconds and do my work. I have added 7 resources in 20 seconds
which would otherwise take a very long time to do manually in AWS.

Now I will login to my AWS account to confirm each resource is available for use.
This is my test VPC in my AWS account and it is running.

This is my test subnet which is now available to use which is ideal for internal access only.

This is my Route Table with a Internet Gateway Route which is now active
so network traffic from subnet or gateway can be directed.

My EC2 is also running in my AWS account for my computing need.
More instances can be added and removed at scale depending on my requirements.

Lastly, when all work is done I can now type terraform destroy to remove all
running services which takes 20 seconds compared to doing it manually directly
on AWS which will take much longer. This way there is no additional cost, saving money and time.