- Newest
- Most votes
- Most comments
Unfortunately, there isn't a straightforward "force update" command in AWS CDK to change the record types of an existing service as described in your error message. The error you're encountering is due to a fundamental limitation in AWS CloudFormation, which CDK uses under the hood.
CloudFormation does not allow changing the record types of an existing service. In this case, you're trying to add an SRV record to a service that previously only had an A record, which is not permitted.
Given this limitation, your options are somewhat limited:
-
Delete and redeploy: This is the most straightforward approach, though it may cause some downtime or require careful orchestration.
-
Create a new service: Instead of modifying the existing service, you could create a new service with both A and SRV records, then update your other resources to use this new service.
-
Use a custom resource: You might be able to use a custom resource in your CDK stack to manipulate the service outside of CloudFormation's normal processes. This is an advanced approach and requires careful implementation.
-
Manually update the service: You could temporarily remove the service from your CDK stack, manually update it in the AWS console or via AWS CLI, and then import it back into your CDK stack.
If you choose to import the manually updated resource back into your CDK stack, you can use the cdk import
command. This allows you to bring existing resources under CDK management without recreating them.
Remember, whichever approach you choose, it's crucial to test thoroughly in a non-production environment first, as these changes can potentially cause service disruptions.
Sources
How to import existing resources into AWS CDK Stacks | AWS DevOps Blog
Relevant content
- asked 5 months ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 5 months ago