Skip to content
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

chore: jump host for db connection from local using ssm #20

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
44 changes: 44 additions & 0 deletions infrastructure/api/ec2.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
resource "aws_security_group" "jumphost" {
name = "${var.app_name}-jumphost-access"
description = "Allow access to jumphost via ssm"
vpc_id = data.aws_vpc.main.id
ingress {
protocol = "tcp"
from_port = 3389
to_port = 3389
security_groups = [data.aws_security_group.web.id]
}
Dismissed Show dismissed Hide dismissed

ingress {
protocol = "tcp"
from_port = 3389
to_port = 3389
security_groups = [data.aws_security_group.app.id]
}
Dismissed Show dismissed Hide dismissed
}
data "aws_ami" "amzn-linux-2023-ami" {
most_recent = true
owners = ["amazon"]

filter {
name = "name"
values = ["al2023-ami-2023.*-x86_64"]
}
}

resource "aws_instance" "jumphost" {
ami = data.aws_ami.amzn-linux-2023-ami.id
instance_type = "t2.micro"
subnet_id = data.aws_subnets.app.ids[0]
vpc_security_group_ids = [data.aws_security_group.app.id, aws_security_group.jumphost.id]
ebs_optimized = false
ebs_block_device {
device_name = "${var.app_env}/dev/xvda"
encrypted = true
volume_size = 8
}

tags = {
Name = "jumphost-${var.app_env}"
}
}
Dismissed Show dismissed Hide dismissed
Dismissed Show dismissed Hide dismissed
Loading