Hash in the Logical Id of the resources in CDK/Cloudformation

狂风中的少年 提交于 2020-02-25 03:58:28

问题


Whenever I generate cloudformation template from CDK, I see that in logical ids, it adds some kind of Hash. What does that Hash mean? Eg.

Test4FCEEF4A

How does this Hash 4FCEEF4A gets generated?


回答1:


The logical IDs for resources are set using the allocateLogicalId method which you can find here. It calls the makeUniqueId method which you can find here. In the makeUniqueId method, it creates a hash component of the logical ID and a human-readable component of the logical ID. It uses the crypto library to create an md5 hash using path, which it gets from the IDs of the nodes of the CfnElement and returns a hex value. So the Hash 4FCEEF4A you see is the hash component that is created in the makeUniqueId method.



来源:https://stackoverflow.com/questions/56729322/hash-in-the-logical-id-of-the-resources-in-cdk-cloudformation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!