When using the CDK to create resources you may want to override some properties of an individual resource that can’t be done with the Construct. A good example is the RDS Cluster construct’s instances that are created. I am in the process of migrating certain clusters to use the new Graviton2 processors and want to do it a single instance at a time to avoid outages.
Luckily, the CDK makes it easy to access those underlying CFN resources and override them.
1 | cluster = aws_rds.DatabaseCluster( |
In this case I am, for debugging purposes, outputting all the resource IDs. Then using the correct ID I convert it to a CFN resource and override the parameter I want. Now I will end up with one db.r5.large
instance and one db.r6g.large
instance.
Since the CDK doesn’t support 11.9 for Aurora yet I’ve had to manually specify the major and full versions, but luckily that will be resolved soon 😃.