Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

531
Views
No puedo hacer que AWS Aurora Postgres RDS esté disponible públicamente

Estoy tratando de poner en marcha un clúster de Aurora Postgres y parece que no puedo hacerlo disponible a través de Internet. Estoy usando Terraform para codificar la infraestructura.

Creé un grupo de seguridad para permitir el acceso externo y está conectado a las subredes de la VPC que usa el clúster. Aún así, parece que no puedo acceder a los puntos finales desde mi máquina local.

No puedo entender lo que me estoy perdiendo.

 module "vpc" { source = "terraform-aws-modules/vpc/aws" version = ">=3.11.0" name = "vpc-auroradb-${var.environment}" cidr = var.vpc_cidr_block azs = var.availability_zones private_subnets = var.vpc_private_subnets public_subnets = var.vpc_public_subnets database_subnets = var.vpc_database_subnets enable_nat_gateway = true enable_dns_hostnames = true enable_dns_support = true create_igw = true create_database_internet_gateway_route = true create_database_nat_gateway_route = true create_database_subnet_group = true create_database_subnet_route_table = true } module "aurora_cluster" { source = "terraform-aws-modules/rds-aurora/aws" version = ">=6.1.3" name = "bambi-${var.environment}" engine = "aurora-postgresql" engine_version = "12.8" instance_class = "db.t4g.large" publicly_accessible = true instances = { 1 = { identifier = "bambi-1" } 2 = { identifier = "bambi-2" } } autoscaling_enabled = true autoscaling_min_capacity = 2 autoscaling_max_capacity = 3 vpc_id = module.vpc.vpc_id db_subnet_group_name = module.vpc.database_subnet_group_name create_db_subnet_group = false create_security_group = false iam_database_authentication_enabled = true storage_encrypted = true apply_immediately = true monitoring_interval = 30 db_parameter_group_name = aws_db_parameter_group.parameter_group.id db_cluster_parameter_group_name = aws_rds_cluster_parameter_group.parameter_group.id vpc_security_group_ids = [aws_security_group.sg_public.id] enabled_cloudwatch_logs_exports = ["postgresql"] } resource "aws_security_group" "sg_public" { vpc_id = module.vpc.vpc_id ingress { from_port = 5432 to_port = 5432 protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] # Allowing traffic in from all sources } egress { from_port = 0 # Allowing any incoming port to_port = 0 # Allowing any outgoing port protocol = "-1" # Allowing any outgoing protocol cidr_blocks = ["0.0.0.0/0"] # Allowing traffic out to all IP addresses } }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

De la documentación del módulo VPC utilizado, para tener acceso público a la base de datos, necesita lo siguiente:

 create_database_subnet_group = true create_database_subnet_route_table = true create_database_internet_gateway_route = true enable_dns_hostnames = true enable_dns_support = true

create_database_nat_gateway_route no debe ser verdadero. Si echamos un vistazo al código del módulo en github :

 resource "aws_route" "database_internet_gateway" { count = var.create_vpc && var.create_igw && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.create_database_internet_gateway_route && false == var.create_database_nat_gateway_route ? 1 : 0 route_table_id = aws_route_table.database[0].id destination_cidr_block = "0.0.0.0/0" gateway_id = aws_internet_gateway.this[0].id timeouts { create = "5m" } }

Podemos ver que el count de la ruta para la puerta de enlace de Internet será 0 . Esto significa que la ruta que permitiría el acceso público a Internet no se crea para la subred de la base de datos.

Por otro lado, establecer create_database_internet_gateway_route en true también bloqueará el acceso a través de la puerta de enlace NAT, ya que la tabla de rutas no tendrá la ruta correcta.

 resource "aws_route" "database_nat_gateway" { count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && false == var.create_database_internet_gateway_route && var.create_database_nat_gateway_route && var.enable_nat_gateway ? var.single_nat_gateway ? 1 : length(var.database_subnets) : 0 route_table_id = element(aws_route_table.database.*.id, count.index) destination_cidr_block = "0.0.0.0/0" nat_gateway_id = element(aws_nat_gateway.this.*.id, count.index) timeouts { create = "5m" } }

Esencialmente, bloquea todo el tráfico configurando ambas variables en verdadero.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!