-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create AWS cloud resources to access the ElastiCache cluster from Amazon EC2 instances. #40
Conversation
resource "aws_instance" "app-server-read" { | ||
instance_type = var.instance_type | ||
ami = data.aws_ami.amazon_ami.id | ||
vpc_security_group_ids = [aws_security_group.ec2_instance.id] | ||
iam_instance_profile = aws_iam_instance_profile.ec2_profile.name | ||
associate_public_ip_address = true | ||
#checkov:skip=CKV_AWS_88: Required for Session Manager access | ||
subnet_id = aws_subnet.public[0].id | ||
ebs_optimized = true | ||
monitoring = true | ||
root_block_device { | ||
encrypted = true | ||
} | ||
metadata_options { | ||
http_endpoint = "enabled" | ||
http_tokens = "required" | ||
} | ||
tags = { | ||
Name = "app-4-server-read" | ||
} | ||
user_data = templatefile("user_data/read_elasticache.tpl", | ||
{ | ||
Region = var.region, | ||
elasticache_ep = aws_ssm_parameter.elasticache_ep.name, | ||
elasticache_ep_port = aws_ssm_parameter.elasticache_port.name, | ||
elasticache_auth_token = aws_secretsmanager_secret.elasticache_auth.name | ||
}) | ||
} |
Check warning
Code scanning / checkov
EC2 instance should not have public IP. Warning
resource "aws_instance" "app-server-write" { | ||
instance_type = var.instance_type | ||
ami = data.aws_ami.amazon_ami.id | ||
vpc_security_group_ids = [aws_security_group.ec2_instance.id] | ||
iam_instance_profile = aws_iam_instance_profile.ec2_profile.name | ||
associate_public_ip_address = true | ||
#checkov:skip=CKV_AWS_88: Required for Session Manager access | ||
subnet_id = aws_subnet.public[0].id | ||
ebs_optimized = true | ||
monitoring = true | ||
root_block_device { | ||
encrypted = true | ||
} | ||
metadata_options { | ||
http_endpoint = "enabled" | ||
http_tokens = "required" | ||
} | ||
tags = { | ||
Name = "app-4-server-write" | ||
} | ||
user_data = templatefile("user_data/write_elasticache.tpl", | ||
{ | ||
Region = var.region, | ||
elasticache_ep = aws_ssm_parameter.elasticache_ep.name, | ||
elasticache_ep_port = aws_ssm_parameter.elasticache_port.name, | ||
elasticache_auth_token = aws_secretsmanager_secret.elasticache_auth.name | ||
}) | ||
} |
Check warning
Code scanning / checkov
EC2 instance should not have public IP. Warning
Infracost report💰 Monthly cost will increase by $67 📈
Cost details
|
Terraform Format and Style 🖌
|
Terraform Format and Style 🖌
|
The changes in this PR:
This PR closes #14