Going to the Cloud
Now that we have a basic understanding on how to use Terraform, we can look into more intermediate usages by utilising cloud providers. Since servers require a lot more info such as the network CIDRs, inbound and outbound connections, image IDs and more, we will need to start organising our files from the get-go to reduce the amount of clutter we might get later on when we scale.
AWS Provider
Start by setting up your providers.tf file in accordance to the AWS Provider documentation.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.70.0"
}
}
}
provider "aws" {
region = "us-east-1" # Default for now, we will turn this into a variable later on
}
Now, initialise this environment with terraform init
so you have the files necessary to create resources, then log into your AWS User/IAM through the AWS CLI tool if you have not already.
Creating an EC2 Instance
Last updated
Was this helpful?