Skip to content

Can't get proper DBCluster port #8549

@dekoza

Description

@dekoza

This look like regression - there was already similar bug: #2711

I try to configure RDS using CDK in Python and then pass port number to ECS.

This is how the DBCluster is created:

    cluster = rds.DatabaseCluster(
        stack,
        "MyDBCluster",
        #master_user=...
        default_database_name=DATABASE_NAME,
        engine=rds.DatabaseClusterEngine.AURORA_POSTGRESQL,
        engine_version="11.6",
        instances=1,
        parameter_group=rds.ClusterParameterGroup.from_parameter_group_name(
            stack, "MyParamGroup", "default.aurora-postgresql11"
        ),
        instance_props=rds.InstanceProps(
            instance_type=ec2.InstanceType.of(
                ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM,
            ),
            vpc=vpc,
        ),
        removal_policy=core.RemovalPolicy.RETAIN,
    )

and here is the ECS pattern:

ecs_patterns.ApplicationLoadBalancedFargateService(
        stack,
        "BackendService",
        # cluster= previously created ECS cluster...
        desired_count=1,
        task_image_options=ecs_patterns.ApplicationLoadBalancedTaskImageOptions(
            image=ecs.ContainerImage.from_ecr_repository(
                # repo and tag passed from previously created objects
            ),
            environment={
                "POSTGRES_DB": DATABASE_NAME,
                "POSTGRES_HOST": database.cluster_endpoint.hostname,
                "POSTGRES_PORT": str(database.cluster_endpoint.port),
                "POSTGRES_USER": DB_USER,
                "POSTGRES_PASSWORD": DB_PASS,
            },
        ),
)

After that POSTGRES_PORT has value "-1.8881545897087736e+289".

Expected result

POSTGRES_PORT should have value "3306".

Environment

  • CLI Version :aws-cli/2.0.16 Python/3.7.3 Linux/5.6.15-1-MANJARO botocore/2.0.0dev20
  • Framework Version: 1.45.0
  • Node.js Version: v14.3.0
  • OS : Manjaro Linux
  • Language (Version): Python 3.7/3.8

This is 🐛 Bug Report

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-rdsRelated to Amazon Relational DatabasebugThis issue is a bug.closed-for-stalenessThis issue was automatically closed because it hadn't received any attention in a while.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions