Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
每当我从 CDK 生成 cloudformation 模板时,我都会在逻辑 ID 中看到它添加了某种哈希。那个哈希是什么意思?例如。
测试4FCEEF4A
这个哈希 4FCEEF4A 是如何生成的?
allocateLogicalId使用您可以在此处找到的方法设置资源的逻辑 ID 。它调用makeUniqueId您可以在此处找到的方法。在该makeUniqueId方法中,它创建逻辑ID的hash组件和逻辑ID的human可读组件。它使用crypto库来创建一个 md5 哈希path,它从 CfnElement 的节点的 ID 中获取并返回一个十六进制值。所以你看到的 Hash 4FCEEF4A 就是方法hash中创建的组件makeUniqueId。
allocateLogicalId
makeUniqueId
hash
human
crypto
path