Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

"Invalid subnet group name" for CfnDBCluster #6519

Closed
matwerber1 opened this issue Feb 29, 2020 · 2 comments
Closed

"Invalid subnet group name" for CfnDBCluster #6519

matwerber1 opened this issue Feb 29, 2020 · 2 comments
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@matwerber1
Copy link
Contributor

matwerber1 commented Feb 29, 2020

Hi,

I successfully create a database subnet group but then, when trying to use it to create an Aurora Serverless PG cluster, receive an error that the subnet group does not exist.

Reproduction Steps

I created a CfnDBSubnetGroup like below.

    const dbSubnetGroup = new rds.CfnDBSubnetGroup(this, 'DatabaseSubnetGroup', {
      dbSubnetGroupDescription: 'Subnet group for Airflow database',
      dbSubnetGroupName: 'AirflowDbSubnetGroup',
      subnetIds: CFG.db.subnetIds
    });

cdk deploy was successful for the above, and I can see the subnet group in the RDS console.

I then try to create an Aurora Serverless Postgres cluster per below:

    const aurora = new rds.CfnDBCluster(this, 'AuroraAirflow', {
      databaseName: CFG.db.databaseName,
      dbClusterIdentifier: CFG.db.dbClusterIdentifier,
      engine: CFG.db.engine,
      engineMode: CFG.db.engineMode,
      masterUsername: CFG.db.masterUsername,
      masterUserPassword: databasePasswordSecret.secretValue.toString(),
      port: CFG.db.port,
      dbSubnetGroupName: dbSubnetGroup.dbSubnetGroupName,
      vpcSecurityGroupIds: CFG.db.vpcSecurityGroupIds,
      scalingConfiguration: {
        autoPause: CFG.db.autoPause,
        maxCapacity: CFG.db.maxCapacity,
        minCapacity: CFG.db.minCapacity,
      }
    });

Then, cdk deploy gives the error below:

Error Log

AuroraAirflow DB subnet group 'AirflowDbSubnetGroup' does not exist. (Service: AmazonRDS; Status Code: 404; Error Code: DBSubnetGroupNotFoundFault; Request ID: cfd07435-a361-45cd-ac1a-bf2c54819e47)

Environment

  • CLI Version : aws-cli/1.16.307 Python/3.7.0 Darwin/18.7.0 botocore/1.13.43
  • Framework Version: CDK version 1.26
  • OS : Mac Mojave 10.14.6
  • Language : Typescript

Other

I tried first deploying my template with only the db subnet group, in case the subnet group was perhaps created but not yet "ready" for use with Aurora... but I received the same error after then adding in the CfnDBCluster resource.

Also tried an explicit dependency, below:

aurora.node.addDependency(dbSubnetGroup);

This is 🐛 Bug Report

@matwerber1 matwerber1 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 29, 2020
@matwerber1
Copy link
Contributor Author

The issue was that I was using CamelCase in the CDK template, but capital letters were converted to lowercase in the actual name of the subnet group that was created.

So, the CfnDBCluster was looking for AirflowDbSubnetGroup when the real resource was named airflowdbsubnetgroup.

@Nicko-13
Copy link

Nicko-13 commented Dec 27, 2021

I have experienced the same issue. I have also noticed that this is inconsistent depending on type of resources I have created.

Here is the definition of subnet group.

        db_subnet_group_name = 'DbSubnetGroup'
        self.__database_subnet_group = CfnDBSubnetGroup(
            self,
            id=db_subnet_group_name,
            db_subnet_group_name=db_subnet_group_name,
            db_subnet_group_description='List of isolated subnet ids',
            subnet_ids=[subnet.subnet_id for subnet in vpc.isolated_subnets]
        )

Then I define CfnDBInstance and this works fine:

        db_name = 'Db'
        self.__database = CfnDBInstance(
            self,
            id=db_name,
            db_name=db_name,
            db_instance_class='db.t2.micro',
            db_subnet_group_name=self.__database_subnet_group.db_subnet_group_name,
            ... # other code omitted for brevity
        )

After that I define CfnDBCluster:

        cluster_name = 'ClusterlDb'
        self.__cluster_db = CfnDBCluster(
            scope=self,
            id=cluster_name,
            backup_retention_period=7,
            db_cluster_identifier= cluster_name,
            db_subnet_group_name=self.__database_subnet_group.db_subnet_group_name,
           ... # other code omitted for brevity
        )

Which throws the following exception: DB subnet group 'DbSubnetGroup' does not exist.
The fix is to add .lower method to the subnet group name:

        cluster_name = 'ClusterlDb'
        self.__cluster_db = CfnDBCluster(
            scope=self,
            id=cluster_name,
            backup_retention_period=7,
            db_cluster_identifier= cluster_name,
            db_subnet_group_name=self.__database_subnet_group.db_subnet_group_name.lower(),
           ... # other code omitted for brevity
        )

In this case stack creates correctly. And it seems like that different constructs should demonstrate similar behaviour.

mergify bot pushed a commit that referenced this issue Aug 15, 2024
Bumps [axios](https://github.com/axios/axios) from 1.7.2 to 1.7.4.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/axios/axios/releases">axios's releases</a>.</em></p>
<blockquote>
<h2>Release v1.7.4</h2>
<h2>Release notes:</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>sec:</strong> CVE-2024-39338 (<a href="https://github.com/axios/axios/issues/6539">#6539</a>) (<a href="https://github.com/axios/axios/issues/6543">#6543</a>) (<a href="https://github.com/axios/axios/commit/6b6b605eaf73852fb2dae033f1e786155959de3a">6b6b605</a>)</li>
<li><strong>sec:</strong> disregard protocol-relative URL to remediate SSRF (<a href="https://github.com/axios/axios/issues/6539">#6539</a>) (<a href="https://github.com/axios/axios/commit/07a661a2a6b9092c4aa640dcc7f724ec5e65bdda">07a661a</a>)</li>
</ul>
<h3>Contributors to this release</h3>
<ul>
<li> <a href="https://github.com/levpachmanov" title="+47/-11 ([#6543](axios/axios#6543) )">Lev Pachmanov</a></li>
<li> <a href="https://github.com/hainenber" title="+49/-4 ([#6539](axios/axios#6539) )">Đỗ Trọng Hải</a></li>
</ul>
<h2>Release v1.7.3</h2>
<h2>Release notes:</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>adapter:</strong> fix progress event emitting; (<a href="https://github.com/axios/axios/issues/6518">#6518</a>) (<a href="https://github.com/axios/axios/commit/e3c76fc9bdd03aa4d98afaf211df943e2031453f">e3c76fc</a>)</li>
<li><strong>fetch:</strong> fix withCredentials request config (<a href="https://github.com/axios/axios/issues/6505">#6505</a>) (<a href="https://github.com/axios/axios/commit/85d4d0ea0aae91082f04e303dec46510d1b4e787">85d4d0e</a>)</li>
<li><strong>xhr:</strong> return original config on errors from XHR adapter (<a href="https://github.com/axios/axios/issues/6515">#6515</a>) (<a href="https://github.com/axios/axios/commit/8966ee7ea62ecbd6cfb39a905939bcdab5cf6388">8966ee7</a>)</li>
</ul>
<h3>Contributors to this release</h3>
<ul>
<li> <a href="https://github.com/DigitalBrainJS" title="+211/-159 ([#6518](axios/axios#6518) [#6519](axios/axios#6519) )">Dmitriy Mozgovoy</a></li>
<li> <a href="https://github.com/ValeraS" title="+3/-3 ([#6515](axios/axios#6515) )">Valerii Sidorenko</a></li>
<li> <a href="https://github.com/prianyu" title="+2/-2 ([#6505](axios/axios#6505) )">prianYu</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/axios/axios/blob/v1.x/CHANGELOG.md">axios's changelog</a>.</em></p>
<blockquote>
<h2><a href="https://github.com/axios/axios/compare/v1.7.3...v1.7.4">1.7.4</a> (2024-08-13)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>sec:</strong> CVE-2024-39338 (<a href="https://github.com/axios/axios/issues/6539">#6539</a>) (<a href="https://github.com/axios/axios/issues/6543">#6543</a>) (<a href="https://github.com/axios/axios/commit/6b6b605eaf73852fb2dae033f1e786155959de3a">6b6b605</a>)</li>
<li><strong>sec:</strong> disregard protocol-relative URL to remediate SSRF (<a href="https://github.com/axios/axios/issues/6539">#6539</a>) (<a href="https://github.com/axios/axios/commit/07a661a2a6b9092c4aa640dcc7f724ec5e65bdda">07a661a</a>)</li>
</ul>
<h3>Contributors to this release</h3>
<ul>
<li> <a href="https://github.com/levpachmanov" title="+47/-11 ([#6543](axios/axios#6543) )">Lev Pachmanov</a></li>
<li> <a href="https://github.com/hainenber" title="+49/-4 ([#6539](axios/axios#6539) )">Đỗ Trọng Hải</a></li>
</ul>
<h2><a href="https://github.com/axios/axios/compare/v1.7.2...v1.7.3">1.7.3</a> (2024-08-01)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>adapter:</strong> fix progress event emitting; (<a href="https://github.com/axios/axios/issues/6518">#6518</a>) (<a href="https://github.com/axios/axios/commit/e3c76fc9bdd03aa4d98afaf211df943e2031453f">e3c76fc</a>)</li>
<li><strong>fetch:</strong> fix withCredentials request config (<a href="https://github.com/axios/axios/issues/6505">#6505</a>) (<a href="https://github.com/axios/axios/commit/85d4d0ea0aae91082f04e303dec46510d1b4e787">85d4d0e</a>)</li>
<li><strong>xhr:</strong> return original config on errors from XHR adapter (<a href="https://github.com/axios/axios/issues/6515">#6515</a>) (<a href="https://github.com/axios/axios/commit/8966ee7ea62ecbd6cfb39a905939bcdab5cf6388">8966ee7</a>)</li>
</ul>
<h3>Contributors to this release</h3>
<ul>
<li> <a href="https://github.com/DigitalBrainJS" title="+211/-159 ([#6518](axios/axios#6518) [#6519](axios/axios#6519) )">Dmitriy Mozgovoy</a></li>
<li> <a href="https://github.com/ValeraS" title="+3/-3 ([#6515](axios/axios#6515) )">Valerii Sidorenko</a></li>
<li> <a href="https://github.com/prianyu" title="+2/-2 ([#6505](axios/axios#6505) )">prianYu</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/axios/axios/commit/abd24a7367726616e60dfc04cb394b4be37cf597"><code>abd24a7</code></a> chore(release): v1.7.4 (<a href="https://github.com/axios/axios/issues/6544">#6544</a>)</li>
<li><a href="https://github.com/axios/axios/commit/6b6b605eaf73852fb2dae033f1e786155959de3a"><code>6b6b605</code></a> fix(sec): CVE-2024-39338 (<a href="https://github.com/axios/axios/issues/6539">#6539</a>) (<a href="https://github.com/axios/axios/issues/6543">#6543</a>)</li>
<li><a href="https://github.com/axios/axios/commit/07a661a2a6b9092c4aa640dcc7f724ec5e65bdda"><code>07a661a</code></a> fix(sec): disregard protocol-relative URL to remediate SSRF (<a href="https://github.com/axios/axios/issues/6539">#6539</a>)</li>
<li><a href="https://github.com/axios/axios/commit/c6cce43cd94489f655f4488c5a50ecaf781c94f2"><code>c6cce43</code></a> chore(release): v1.7.3 (<a href="https://github.com/axios/axios/issues/6521">#6521</a>)</li>
<li><a href="https://github.com/axios/axios/commit/e3c76fc9bdd03aa4d98afaf211df943e2031453f"><code>e3c76fc</code></a> fix(adapter): fix progress event emitting; (<a href="https://github.com/axios/axios/issues/6518">#6518</a>)</li>
<li><a href="https://github.com/axios/axios/commit/85d4d0ea0aae91082f04e303dec46510d1b4e787"><code>85d4d0e</code></a> fix(fetch): fix withCredentials request config (<a href="https://github.com/axios/axios/issues/6505">#6505</a>)</li>
<li><a href="https://github.com/axios/axios/commit/92cd8ed94362f929d3d0ed85ca84296c0ac8fd6d"><code>92cd8ed</code></a> chore(github): update ISSUE_TEMPLATE.md (<a href="https://github.com/axios/axios/issues/6519">#6519</a>)</li>
<li><a href="https://github.com/axios/axios/commit/8966ee7ea62ecbd6cfb39a905939bcdab5cf6388"><code>8966ee7</code></a> fix(xhr): return original config on errors from XHR adapter (<a href="https://github.com/axios/axios/issues/6515">#6515</a>)</li>
<li>See full diff in <a href="https://github.com/axios/axios/compare/v1.7.2...v1.7.4">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=axios&package-manager=npm_and_yarn&previous-version=1.7.2&new-version=1.7.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/aws/aws-cdk/network/alerts).

</details>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants