Skip to content

Cloud infrastructure built with HashiCorp Configuration Language (HCL) to deploy a single ec2 instance on Amazon Web Services.

License

Notifications You must be signed in to change notification settings

etoromol/aws-single-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aws-single-node

This is a custom Infrastructure As Code (IaC) solution, written in Hashicorp Configuration Language (HCL). It facilitates the deployment of a single Elastic Compute Cloud (EC2) instance on Amazon Web Services (AWS). The solution includes a pool of EC2 instances under the Variable Component which can be tailored to meet specific requirements.

Why Terraform?

Terraform enables you to safely and predictably create, change and improve infrastructures. This allows a blueprint of your datacenter to be versioned and treated as you would any other code. Additionally, infrastuctures can be shared and re-used.

Prerequisites

To deploy this infrastructure you will need:

Installation

  1. Clone the solution repository to your local device:
git clone https://github.com/etoromol/aws-single-node.git
cd aws-single-node
  1. Initialize the working directory with Terraform:
terraform init

Configuration

  1. Authenticate your AWS account in AWS CLI using your terminal. You will be prompted to enter your AWS Access Key ID and Secret Access Key.
aws configure

The configuration process stores your credentials in a file at ~/.aws/credentials on MacOS and Linux, or %UserProfile%.aws\credentials on Windows.

  1. Navigate to the Variable Component (variable.tf) and customize the solution's details according to your requirements (description, tag, access_key etc.).
variable "project" {
  description = "Cloud VM Infrastructure as Code" <-
  type        = map(string)
  default = {
    tag        = "cloud"                          <-
    access_key = "ssh-cloud-key"                  <-
  }
}

Deployment

  1. Initiate the deployment process:
terraform apply

It is recommended that you review the deployment plan before with "terraform plan".

  1. Once your EC2 instance is ready, you may access it using your SSH key:
ssh -i "path/to-your/ssh_key" ec2-user@instance_public_ip

You can obtain the value of instance_public_ip running "terraform output"

  1. If the infrastructure is no longer required, it should be destroyed.:
terraform destroy

Terraform will present the deployment and destruction plans before and after initialization. Proceed with the destruction/deployment by typing 'yes'; otherwise, Terraform will not proceed any further.

License

Copyright (c) 2023 Eduardo Toro.

Licensed under the MIT license.

About

Cloud infrastructure built with HashiCorp Configuration Language (HCL) to deploy a single ec2 instance on Amazon Web Services.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages