Low Orbit Flux Logo 2 F

Terraform Basics - AWS

The purpose of this section is just to show you how you would do things differently if you were using AWS instead of Docker. We’ve already covered most of the basic commands and configs using Docker as an example in the previous sections.

This section is similar to the previous Docker based build except that it includes a few AWS based options and will build AWS infrastructure.

Create the project dir:

mkdir test1
cd test1

The configuration will look like this:

terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 4.16" } } required_version = ">= 1.2.0" } provider "aws" { region = "us-west-2" } resource "aws_instance" "app_server" { ami = "ami-830c94e3" instance_type = "t2.micro" tags = { Name = "ExampleAppServerInstance" } }

In this example we specify some AWS specific variables including the region, ami, and instance type:

region  = "us-west-2"
ami           = "ami-830c94e3"
instance_type = "t2.micro"

You can initialize, plan, and apply similar to the previous docker based example.

terraform init
terraform plan
terraform apply