Skip to content

aws_glue.CfnConnection: JDBC Connection does not work without optional availability_zone param #32959

Open
@Lizards

Description

@Lizards

Describe the bug

The availability_zone param is optional for aws_glue.CfnConnection.PhysicalConnectionRequirementsProperty. A Connection resource is successfully created without it. However, "Test Connection" in the AWS Console fails with a cryptic error: InvalidInputException: Unable to resolve any valid connection

I noticed the Connection would work if I saved it in the AWS Console without changes. There is no field for Availability Zone in the UI, but the parameter is present in the network request when a Connection is saved. Inspecting that network request was the only way I was able to narrow down the problem. "Test Connection" worked after I added this optional param in CDK.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

I would expect failure to create the resource if it's not valid, or the value to be set on behalf of the user as it is in the AWS console, or a more actionable error message in the AWS Console.

Current Behavior

A nonfunctional resource is created without an obvious path to troubleshoot.

Reproduction Steps

aws_glue.CfnConnection(
    self,
    "some_connection_id",
    catalog_id="some_catalog_id",
    connection_input=aws_glue.CfnConnection.ConnectionInputProperty(
        name="some jdbc connection",
        connection_type="JDBC",
        connection_properties={
            "JDBC_CONNECTION_URL": "jdbc:mysql://some-cluster.us-west-2.rds.amazonaws.com:3306/some_database",
            "JDBC_ENFORCE_SSL": False,
            "SECRET_ID": "some_secret_id",
        },
        physical_connection_requirements=aws_glue.CfnConnection.PhysicalConnectionRequirementsProperty(
            availability_zone="us-west-2a",   # <-- here
            subnet_id="some_subnet_id",
            security_group_id_list=["some_security_group_id"],
        ),
    ),
)

Possible Solution

  • CloudFormation fails to create an invalid Connection resource, or
  • Make availability_zone required, or
  • Populate the value on behalf of the user like the AWS Console does, or
  • Mention this somewhere in the documentation/docstrings, or
  • Provide a more actionable error message

Additional Information/Context

No response

CDK CLI Version

2.149.0 (build c8e5924)

Framework Version

No response

Node.js Version

18.15.0

OS

macOS

Language

Python

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions