Skip to content

Instantly share code, notes, and snippets.

@53845714nF
Last active October 13, 2022 11:30
Show Gist options
  • Save 53845714nF/088dcc07628cd2436c61b91c154a2b9f to your computer and use it in GitHub Desktop.
Save 53845714nF/088dcc07628cd2436c61b91c154a2b9f to your computer and use it in GitHub Desktop.
Terraform AWS EC2 Ubuntu Server
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
}
}
provider "aws" {
region = "us-east-1"
access_key = ""
secret_key = ""
token= ""
}
module "ec2_instance" {
source = "terraform-aws-modules/ec2-instance/aws"
version = "~> 3.0"
name = "single-instance"
ami = "ami-08c40ec9ead489470"
instance_type = "t2.nano"
key_name = "thb"
monitoring = false
vpc_security_group_ids = ["sg-019b07b0cafc83419"]
subnet_id = "subnet-0424b8e0e0e35c639"
tags = {
Terraform = "true"
Environment = "dev"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment