@@ -50,19 +50,23 @@ resource "aws_instance" "app-server-read" {
50
50
iam_instance_profile = aws_iam_instance_profile. ec2_profile . name
51
51
associate_public_ip_address = true
52
52
subnet_id = aws_subnet. public [0 ]. id
53
- ebs_optimized = true
54
- monitoring = true
53
+ ebs_optimized = true
54
+ monitoring = true
55
55
root_block_device {
56
56
encrypted = true
57
57
}
58
+ metadata_options {
59
+ http_endpoint = " enabled"
60
+ http_tokens = " required"
61
+ }
58
62
tags = {
59
63
Name = " app-4-server-read"
60
64
}
61
65
user_data = templatefile (" user_data/read_elasticache.tpl" ,
62
66
{
63
- Region = var.region,
64
- elasticache_ep = aws_ssm_parameter.elasticache_ep.name,
65
- elasticache_ep_port = aws_ssm_parameter.elasticache_port.name,
67
+ Region = var.region,
68
+ elasticache_ep = aws_ssm_parameter.elasticache_ep.name,
69
+ elasticache_ep_port = aws_ssm_parameter.elasticache_port.name,
66
70
elasticache_auth_token = aws_secretsmanager_secret.elasticache_auth.name
67
71
})
68
72
}
@@ -73,19 +77,23 @@ resource "aws_instance" "app-server-write" {
73
77
iam_instance_profile = aws_iam_instance_profile. ec2_profile . name
74
78
associate_public_ip_address = true
75
79
subnet_id = aws_subnet. public [0 ]. id
76
- ebs_optimized = true
77
- monitoring = true
78
- root_block_device {
80
+ ebs_optimized = true
81
+ monitoring = true
82
+ root_block_device {
79
83
encrypted = true
80
84
}
85
+ metadata_options {
86
+ http_endpoint = " enabled"
87
+ http_tokens = " required"
88
+ }
81
89
tags = {
82
90
Name = " app-4-server-write"
83
91
}
84
92
user_data = templatefile (" user_data/write_elasticache.tpl" ,
85
93
{
86
- Region = var.region,
87
- elasticache_ep = aws_ssm_parameter.elasticache_ep.name,
88
- elasticache_ep_port = aws_ssm_parameter.elasticache_port.name,
94
+ Region = var.region,
95
+ elasticache_ep = aws_ssm_parameter.elasticache_ep.name,
96
+ elasticache_ep_port = aws_ssm_parameter.elasticache_port.name,
89
97
elasticache_auth_token = aws_secretsmanager_secret.elasticache_auth.name
90
98
})
91
99
}
0 commit comments