# cdk-solution-helper A lightweight helper function that cleans-up synthesized templates from the AWS Cloud Development Kit (CDK) and prepares them for use with the AWS Solutions publishing pipeline. This function performs the following tasks: #### Nested stack template URL preparation Replaces the `TemplateURL` generated by the AWS CDK with the location used by the AWS Solution. The bucket name and key prefix are retrieved from the `SourceCode` mapping. Before: ``` "MediaInsightsDataplaneApiStack": { "Type": "AWS::CloudFormation::Stack", "Properties": { "TemplateURL": { "Fn::Join": [ "", [ "https://s3.", { "Ref": "AWS::Region" }, ".", { "Ref": "AWS::URLSuffix" }, "/", { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, "/d20c2ae16e769c1e8fdb1465457252122f86dd10620491ded41616e7c9f9c0bf.json" ] ] }, ``` After helper function run: ``` "MediaInsightsDataplaneApiStack": { "Type": "AWS::CloudFormation::Stack", "Properties": { "TemplateURL": { "Fn::Join": [ "", [ "https://", { "Fn::FindInMap": [ "SourceCode", "General", "GlobalS3Bucket" ] }, ".s3.", { "Ref": "AWS::URLSuffix" }, "/", { "Fn::FindInMap": [ "SourceCode", "General", "TemplateKeyPrefix" ] }, "/media-insights-dataplane-api-stack.template" ] ] }, ``` #### Template cleanup Cleans out parameters and metadata created by AWS CDK that help with `cdk deploy`, but aren't used in the published CloudFormation templates. Also removes some "default policies" that get generated by AWS CDK but are not actually referenced in the template. *** © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.