Issue
What is the purpose of the app.synth()
line in AWS CDK applications? For example it can be seen here on line 29:
https://github.com/aws-samples/aws-cdk-examples/blob/master/typescript/ecs/fargate-application-load-balanced-service/index.ts
I have looked at the CDK docs but I cannot find what the actual purpose of that function is. As I understand it, the app is automatically synthesized upon cdk deploy
or cdk synth
. I also took the example shown in repo linked above, commented out the app.synth()
line, deployed it, and it seemed to work as expected. Therefore I'm wondering if I'm missing something when it comes to the purpose of app.synth()
Solution
cdk synth only constructs your CloudFormation template. It does not deploy (create actual resources) it to AWS. You can take the template constructed, deploy it manually in CFN console, edit or inspect.
cdk deploy is going to construct the template and deploy it to AWS as well.
People use synth
with deploy
because it is a good practice:
It is optional (though good practice) to synthesize before deploying. The AWS CDK synthesizes your stack before each deployment.
Answered By - Marcin
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.