-
Notifications
You must be signed in to change notification settings - Fork 0
/
ec2.tf
91 lines (64 loc) · 1.58 KB
/
ec2.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
resource "aws_eip" "ec2" {
instance = aws_instance.web.id
vpc = true
tags = {
Name = "Mastodon"
}
}
resource "aws_eip" "postgres" {
instance = aws_instance.postgres.id
vpc = true
tags = {
Name = "Mastodon-Postgres"
}
}
resource "aws_instance" "postgres" {
ami = "ami-079f51a7bcca65b92"
instance_type = "t4g.micro"
disable_api_termination = true
associate_public_ip_address = true
availability_zone = "us-west-2a"
iam_instance_profile = aws_iam_instance_profile.postgres.name
ipv6_address_count = 1
key_name = "mastodon"
subnet_id = module.vpc.public_subnets[0]
vpc_security_group_ids = [aws_security_group.postgres.id]
root_block_device {
delete_on_termination = false
iops = 3000
throughput = 125
volume_size = 25
volume_type = "gp3"
}
credit_specification {
cpu_credits = "unlimited"
}
tags = {
Name = "Mastodon-Postgres"
}
}
resource "aws_instance" "web" {
ami = "ami-079f51a7bcca65b92"
instance_type = "t4g.small"
disable_api_termination = true
associate_public_ip_address = true
availability_zone = "us-west-2a"
iam_instance_profile = aws_iam_instance_profile.ec2.name
ipv6_address_count = 1
key_name = "mastodon"
subnet_id = module.vpc.public_subnets[0]
vpc_security_group_ids = [aws_security_group.ec2.id]
root_block_device {
delete_on_termination = false
iops = 3000
throughput = 125
volume_size = 25
volume_type = "gp3"
}
credit_specification {
cpu_credits = "unlimited"
}
tags = {
Name = "Mastodon-Web"
}
}