(aws-appsync): Custom Resource to Perform Manual Merge of a Source API And Signal Cloudformation Based On Merge Operation Result #27170
Labels
@aws-cdk/aws-appsync
Related to AWS AppSync
effort/large
Large work item – several weeks of effort
feature-request
A feature should be added or improved.
p2
Describe the feature
AppSync recently launched Merged APIs: https://aws.amazon.com/blogs/mobile/introducing-merged-apis-on-aws-appsync/.
CDK support has been added to support Merged APIs with the following PRs:
The main resource for Merged APIs is the CfnSourceApiAssociation which links a source API with a merged API. When creating this resource, either through the GraphqlApi construct or the standalone SourceApiAssociation construct, you need to specify a merge type. The default type in CDK is AUTO_MERGE. AUTO_MERGE ensures that any change that is made on a source API is propagated to the Merged API endpoint in the background by the AppSync service itself. However, since this happens outside of Cloudformation, if there is a failure due to a merge conflict, the Cloudformation stack update is not aware of it and will not rollback automatically. Developers may want to ensure that a merge succeeds prior to the Cloudformation stack update succeeding.
Use Case
This feature allows the source API owner to ensure that when merge conflicts are introduced, the Cloudformation stack update would fail and cause a rollback. Otherwise, if the merge is successful, the team knows that the updates were successfully applied to the merged API.
Proposed Solution
I believe we can support this use case with a custom resource in the appsync CDK library. The custom resource would have a lambda function that submits the merge of the source API manually and a Lambda function that handles polling to check when the merge operation has finished. When the operation has finished, it will signal Cloudformation to succeed or fail based on the status of the merge operation.
Some key considerations:
Below is a snippet of code for the POC I have built for this feature:
Implementation for the Lambda handlers:
Other Information
No response
Acknowledgements
CDK version used
v2.96.2
Environment details (OS name and version, etc.)
macOS 13.4
The text was updated successfully, but these errors were encountered: