Friday, February 17, 2023

HANDS-ON FOR STARTERS IN TERRAFORM

 



This steps will guide beginners' on how to provision "ec2" and "VPC" with the use of count and "establish a public IP address".


NOTE : 

 - Failure to specify VPC argument will result to terraform creating the ec2 resource inside the default VPC. 

-  The "ami" should be gotten from your console (ubuntu 18.04)

Lets get a few hands-on:

STEP 1: 

Create a folder, called "Practice-Day1" 

Within the folder create  "ec2.tf file"and "provider.tf"

STEP 2:  

Below is the resource argument for "ec2''

resource "aws_instance" "Env" {
ami = "ami-0263e4deb****0e"
instance_type = "t3.micro"
count = 2
associate_public_ip_address = true
tags = {
Name = "Env"
}
}


STEP 3:

Below is the "provider" argument

terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
}
}

# Configure the AWS Provider
provider "aws" {
region = "us-east-1"
}

# Create a VPC
resource "aws_vpc" "example" {
cidr_block = "10.0.0.0/16"
}


STEP 4:
"cd" into the path of the folder.
 "ls" - list what you have inside the folder.    

STEP 7: 
Apply terraform command

-Init
-Validate
-Plan
-Apply
-Destroy


NB: If you successfully deploy this hands-on, kindly leave a comment and feedbacks. Happy Learning! 😊


No comments:

Post a Comment

CONFIGURING A PHISHING CAMPAIGN IN MICROSOFT DEFENDER.

Configuring a phishing campaign in Microsoft Defender (specifically Microsoft Defender for Office 365) involves creating a simulated attack ...