aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.49k stars 3.84k forks source link

aws_rds: VER_13_13 not available but documentation says otherwise #30445

Closed bayoishola closed 1 month ago

bayoishola commented 3 months ago

Describe the bug

Hi,

In the documentation, it says that Postgres Engine version 13.13 should be available but this isn't the case in the cdk library.

Expected Behavior

DatabaseInstanceEngine.postgres(version=PostgresEngineVersion.VER_13_13)

Current Behavior

DatabaseInstanceEngine.postgres(version=PostgresEngineVersion.VER_13_12) 13.12 is the max minor version for Postgres Engine 13 in the library.

Reproduction Steps

from aws_cdk.aws_rds import DatabaseInstanceEngine, PostgresEngineVersion

DatabaseInstanceEngine.postgres(version=PostgresEngineVersion.VER_13_13)

Possible Solution

@jsii.python.classproperty
    @jsii.member(jsii_name="VER_13_13")
    def VER_13_13(cls) -> "PostgresEngineVersion":
        '''Version "13.13".'''
        return typing.cast("PostgresEngineVersion", jsii.sget(cls, "VER_13_13"))

...

Additional Information/Context

AWS recommends upgrading your Amazon RDS for PostgreSQL databases running minor versions to 13.13.

CDK CLI Version

2.143.0 (build 9f2bdf7)

Framework Version

No response

Node.js Version

v20.11.1

OS

Windows

Language

Python

Language Version

3.9.16

Other information

No response

pahud commented 3 months ago

It should be available

https://github.com/aws/aws-cdk/blob/f9371001f4cb3a921d66992072972d9687e3698e/packages/aws-cdk-lib/aws-rds/lib/instance-engine.ts#L1481

Can you make sure you use the latest AWS CDK and try again?

bayoishola commented 3 months ago

@pahud , thanks for taking a look. I also tried with cdk version 2.144.0 and still no luck.

PS: I am using the Python runtime of the library.

richardgroves commented 2 months ago

VER_15_6 is also listed in the documentation referenced and not actually available in 2.145 (also using Python) - but I do see VER_13_13 listed (and VER_13_14).

bayoishola commented 2 months ago

@richardgroves , do you mean that VER_13_13 is available in 2.145?

richardgroves commented 2 months ago

@bayoishola Yes - I see all of 13.3 through 13.14 enumerated in the Python library for 2.145. For 15 it is just 15.2-15.5, but the code for 15.6 was committed 3 days ago, so maybe released in the next version - shame that 15.7 is already available on console...

from aws_cdk import (
    aws_rds as rds
)
print("DB versions:\n" + "\n".join(rds.AuroraPostgresEngineVersion.__dict__.keys()))

for a hacky dump of the versions available.

bayoishola commented 2 months ago

Thanks for confirming and for the tips as well. @richardgroves

richardgroves commented 2 months ago

Another tip - from CLI you can do this:

aws rds describe-db-engine-versions --engine aurora-postgresql | grep DBEngineVersionDescription

to get a list of the versions available.

From my current CLI version of "aws-cli/2.16.4 Python/3.11.9 Darwin/23.5.0 source/x86_64" I get:

     "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 11.9)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 11.21)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 12.9)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 12.11)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 12.12)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 12.13)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 12.14)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 12.15)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 12.16)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 12.17)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 12.18)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 13.7)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 13.8)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 13.9)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 13.10)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 13.11)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 13.12)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (compatible with PostgreSQL 13.12)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 13.13)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 13.14)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 14.3)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 14.4)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 14.5)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 14.6)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 14.7)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 14.8)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 14.9)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 14.10)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 14.11)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 15.2)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 15.3)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 15.4)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 15.5)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 15.6)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 16.1)",
        "DBEngineVersionDescription": "Aurora PostgreSQL (Compatible with PostgreSQL 16.2)",

So that isn't showing 15.7 and 16.3 which were announced as available on 9th May 2024 - https://aws.amazon.com/about-aws/whats-new/2024/05/amazon-rds-postgresql-supports-new-versions/

There appears to be a lot of lag in the support of new versions across the toolchains.

bayoishola commented 1 month ago

@richardgroves , just getting back to this and I noticed you were looking at aurora postgres (which by the way is available on the console using the command but not in the CDK library) as opposed to rds postgres. Up until aws-cdk-lib version 2.149.0 (current latest release), I still don't see engine version 13_13.

aws rds describe-db-engine-versions --engine postgres | grep DBEngineVersionDescription

@pahud , any update, please?

pahud commented 1 month ago

I can see 13.13 from CLI:

 % aws rds describe-db-engine-versions --engine postgres --query 'DBEngineVersions[*].ValidUpgradeTarget[*].[EngineVersion, Description]' --output text

Also available in doc

https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_rds/PostgresEngineVersion.html

PoC

# create a rds with postgres VER_13_13
rds.DatabaseInstance(
    self,
    "RDSInstance",
    engine=rds.DatabaseInstanceEngine.postgres(version=rds.PostgresEngineVersion.VER_13_13),
    vpc=vpc,
    removal_policy=RemovalPolicy.DESTROY,
)

cdk synth should return 13.13 in EngineVersion:

 RDSInstance9F6B765A:
    Type: AWS::RDS::DBInstance
    Properties:
      AllocatedStorage: "100"
      CopyTagsToSnapshot: true
      DBInstanceClass: db.m5.large
      DBSubnetGroupName:
        Ref: RDSInstanceSubnetGroup84B66507
      Engine: postgres
      EngineVersion: "13.13"
bayoishola commented 1 month ago

@pahud , thanks for responding. What version of the python AWS CDK do you have installed for the above? Thanks!

pahud commented 1 month ago

@bayoishola

% cdk --version
2.149.0 (build c8e5924)
% grep aws-cdk-lib requirements.txt
aws-cdk-lib==2.149.0

Make sure you have activated the venv and pip install the requirements.txt

$ source .venv/bin/activate
$ pip install -r requirements.txt
github-actions[bot] commented 1 month ago

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.