From 6a624e1b7d18ccaeb5af7e8efb3f9a380c7d3ba0 Mon Sep 17 00:00:00 2001 From: Nick Lynch Date: Wed, 29 Jul 2020 15:01:57 +0100 Subject: [PATCH] fix(python/rds): update to new API Upgrades to the engine version specification from the RDS package. --- .../dockerized_app_cdk/rds_stack.py | 5 +++-- .../new-vpc-alb-asg-mysql/cdk_vpc_ec2/cdk_rds_stack.py | 10 ++++++---- python/rds/app.py | 5 +++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/python/docker-app-with-asg-alb/dockerized_app_cdk/rds_stack.py b/python/docker-app-with-asg-alb/dockerized_app_cdk/rds_stack.py index 1086ffc996..b1aa14102b 100644 --- a/python/docker-app-with-asg-alb/dockerized_app_cdk/rds_stack.py +++ b/python/docker-app-with-asg-alb/dockerized_app_cdk/rds_stack.py @@ -30,8 +30,9 @@ def __init__(self, scope: core.Construct, id: str, props, **kwargs) -> None: my_sql = rds.DatabaseInstance( self, "RDS", master_username="test", - engine_version="8.0.16", - engine=rds.DatabaseInstanceEngine.MYSQL, + engine=rds.DatabaseInstanceEngine.mysql( + version=rds.MysqlEngineVersion.VER_8_0_16 + ), vpc=props['vpc'], port=3306, instance_type=ec2.InstanceType.of( diff --git a/python/new-vpc-alb-asg-mysql/cdk_vpc_ec2/cdk_rds_stack.py b/python/new-vpc-alb-asg-mysql/cdk_vpc_ec2/cdk_rds_stack.py index f3ec3b5ce2..b316c19dbf 100644 --- a/python/new-vpc-alb-asg-mysql/cdk_vpc_ec2/cdk_rds_stack.py +++ b/python/new-vpc-alb-asg-mysql/cdk_vpc_ec2/cdk_rds_stack.py @@ -12,8 +12,9 @@ def __init__(self, scope: core.Construct, id: str, vpc, asg_security_groups, **k # Secrets Manager auto generate and keep the password, don't put password in cdk code directly # db_Aurora_cluster = rds.DatabaseCluster(self, "MyAurora", # default_database_name="MyAurora", - # engine=rds.DatabaseClusterEngine.AURORA_MYSQL, - # engine_version="5.7.12", + # engine=rds.DatabaseClusterEngine.arora_mysql( + # version=rds.AuroraMysqlEngineVersion.VER_5_7_12 + # ) # master_user=rds.Login(username="admin"), # instance_props=rds.InstanceProps( # vpc=vpc, @@ -31,8 +32,9 @@ def __init__(self, scope: core.Construct, id: str, vpc, asg_security_groups, **k # Alternatively, create MySQL RDS with CDK High Level API db_mysql_easy = rds.DatabaseInstance(self, "MySQL_DB_easy", - engine=rds.DatabaseInstanceEngine.MYSQL, - engine_version="5.7.22", + engine=rds.DatabaseInstanceEngine.mysql( + version=rds.MysqlEngineVersion.VER_5_7_30 + ), instance_type=ec2.InstanceType.of( ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), master_username="admin", diff --git a/python/rds/app.py b/python/rds/app.py index c63ed85dba..fbc55ff788 100644 --- a/python/rds/app.py +++ b/python/rds/app.py @@ -18,8 +18,9 @@ def __init__(self, app: core.App, id: str, **kwargs) -> None: master_username="master", master_user_password=core.SecretValue.plain_text("password"), database_name="db1", - engine_version="8.0.16", - engine=rds.DatabaseInstanceEngine.MYSQL, + engine=rds.DatabaseInstanceEngine.mysql( + version=rds.MysqlEngineVersion.VER_8_0_16 + ), vpc=vpc, port=3306, instance_type= ec2.InstanceType.of(