1 Answer
- Newest
- Most votes
- Most comments
1
Hello.
The problem is probably that the security group settings are not linked to the following part.
If you do not link security group settings, the VPC default security group will be linked.
So, try modifying the code as below to set the respective security groups for ALB and launch template.
# Application Load Balancer
resource "aws_lb" "my_alb" {
name = "my-alb"
internal = false
load_balancer_type = "application"
subnets = [aws_subnet.public_subnet_1.id, aws_subnet.public_subnet_2.id]
security_groups = [aws_security_group.alb_sg.id]
}
# Launch Template
resource "aws_launch_template" "my_launch_template" {
name_prefix = "my-launch-template-"
image_id = "ami-05d4867ed58f446d9"
instance_type = "t2.micro"
vpc_security_group_ids = [aws_security_group.ec2_sg.id]
# Additional settings can be specified here as needed
}
Relevant content
- asked 2 months ago
- Accepted Answerasked 10 months ago
- asked 9 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 2 years ago
That worked, thanks a million!!