-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialise repo to spin an EC2 instance
- Loading branch information
1 parent
ac6d004
commit 154b7ad
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 3.0" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = "us-east-1" | ||
} | ||
|
||
//referencing ubuntu AMI | ||
data "aws_ami" "ubuntu" { | ||
most_recent = true | ||
owners = ["099720109477"] #Canonical | ||
|
||
filter { | ||
name = "name" | ||
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"] | ||
} | ||
|
||
filter { | ||
name = "virtualization-type" | ||
values = ["hvm"] | ||
} | ||
} | ||
|
||
//spinning up billing server | ||
resource "aws_instance" "billing_server" { | ||
ami = data.aws_ami.ubuntu.id | ||
instance_type = "t2.micro" | ||
tags = { | ||
"service" = "billing" | ||
} | ||
} |