This Terraform project provisions an AWS EC2 instance within a VPC and subnet, with specified configuration. It also includes variables for easy customization.
Before you begin, make sure you have the following prerequisites installed:
-
Create an AWS IAM user with the necessary permissions and configure AWS CLI with the user's credentials.
-
Modify the
main.tf
file to customize the following parameters:instance_type
: EC2 instance type (default: t2.micro).ami_id
: AMI ID for the desired Ubuntu version (default: Ubuntu 20.04 LTS).tags
: Tags to assign to the EC2 instance.vpc_cidr
: CIDR block for the VPC.subnet_cidr
: CIDR block for the subnet.
-
Run
terraform init
to initialize the working directory. -
Run
terraform apply
to create the AWS resources as defined. -
After provisioning is complete, you can get the public IP address of the EC2 instance using the output
instance_public_ip
.
terraform init
terraform apply
terraform destroy
instance_public_ip
: The public IP address of the provisioned EC2 instance
This project is available under the terms of the MIT License
Brian Mathenge