Cloud Infrastructure

Cloud Infrastructure Overview
Cloud infrastructure consists of compute, storage, networking, and security resources hosted by providers like AWS, Azure, and GCP. It enables scalability, cost-efficiency, and reliability for businesses by offering on-demand access to IT resources. Key benefits include flexibility, high availability, and enhanced security, making it the foundation of modern digital solutions.

Terraform

Terraform is an Infrastructure as Code (IaC) tool developed by HashiCorp that allows users to define, provision, and manage cloud infrastructure using a declarative configuration language. It supports multiple cloud providers like AWS, Azure, and Google Cloud.

AWS-CLI

AWS CLI is a command-line tool that allows users to manage AWS services by running commands in a terminal. It enables automation, scripting, and remote management of AWS resources without using the web console.

Steps to configure cloud infrastructure using Terraform and AWS-CLI

Step 1
Open your Visual Code Studio, Go to extensions, serach for AWS-CLI, then download and install AWS-CLI configuration package

Step 2
Sign in to your AWS portal account to get your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
Click on your account name at the top right conner of the portal,
Then click on Security credentials

Step 3
Scroll down and click on create access key

Step 4
Check the agreement box and click on create access key

Step 5
Copy the Access key and Secret key

Step 6
Go to Visual studio code, open your terminal and enter the following command
AWS configure
Enter all parameters as required

Next step is Terraform configuratiom
Step 7
On the terminal create a directory using
'mkdir learn-terraform-aws-instance'

Step 8
Enter into the directory using
'cd learn-terraform-aws-instance'

Step 9
Create a text File using
'touch main.tf' or by clicking on create new file beside the directory
name the file 'main.tf'

Step 10
Go to https://developer.hashicorp.com/terraform/tutorials/aws-get-started/aws-build to get a configuration sample, copy and paste it in the text file you created
make sure you save using ctrl s

Step 11
On the terminal enter
'terraform init' to initialize

Step 12
Format your configuration to allow Terraform print out the names of the files it modified, if any.
'terraform fmt'

Step 13
Validate your configuration using 'terraform validate'

Step 14
Apply the configuration now with the 'terraform apply' command
if asked 'Do you want to perform these actions?' type yes

Step 15
Inspect the current state using 'terraform show'

Other commands
terraform destroy- to destroy terraform
terraform -version- to check the version of terraform
terraform state list- List all resources managed by Terraform
terraform state rm -Manually remove a resource from the state file (without deleting it in the cloud)

Summary

Follwing the above steps we have ben able to configure a cloud infrastructure using terraform on visual studio code.

Author Of article : Adedapo Read full article