[英]How does AWS Amplify cloudformation parameter.json work?
I recently started using AWS Amplify and I've had experience using vanilla cloudformation.我最近开始使用 AWS Amplify,并且有使用 vanilla cloudformation 的经验。 Most of it makes sense except for the
parameters.json
part.除了
parameters.json
部分之外,大部分内容都有意义。
It seems that Amplify generates cloudformation templates for the resources we use, but it also generates a parameters.json
file, which I thought was the equivalent of the Parameters
section of cloudformation, but it doesn't seem to be. Amplify 似乎为我们使用的资源生成了 cloudformation 模板,但它也生成了一个
parameters.json
文件,我认为它相当于 cloudformation 的Parameters
部分,但它似乎不是。
In Amplify parameters.json
the content is just on object
with key-value pairs.在 Amplify
parameters.json
,内容仅在具有键值对的object
上。 Whereas in cloudformation, parameters has a defined syntax as noted in the docs .而在 cloudformation 中,参数具有如文档中所述的定义语法。
Also in parameters.json
it seems to be able to make a Ref
call in the same manner as cloudformation templates.同样在
parameters.json
它似乎能够以与 cloudformation 模板相同的方式进行Ref
调用。 Does anyone know what is parsing the parameters.json
file and replacing Ref
with actual value?有谁知道什么是解析
parameters.json
文件并将Ref
替换为实际值?
For example in the storage
category, the parameters.json
file has key like this例如在
storage
类别中, parameters.json
文件有这样的键
"authRoleName": {
"Ref": "AuthRoleName"
},
AuthRoleName
seems to be defined in both amplify-meta.json
under the backend
directory, but it's also defined in team-provider-info.json
under the amplify
directory. AuthRoleName
好像在backend
目录下的amplify-meta.json
中都有定义,但是在amplify
目录下的team-provider-info.json
也有定义。
Does anyone know which AuthRoleName
file it's using?有谁知道它使用的是哪个
AuthRoleName
文件? From what I read in the docs, both amplify-meta.json
and team-provider-info.json
is auto generated.根据我在文档中读到的内容,
amplify-meta.json
和team-provider-info.json
都是自动生成的。
A lot of these questions came up because I was curious if I could execute the autogenerated CF templates in CF manually in cloudformation UI.出现了很多这些问题,因为我很好奇是否可以在 cloudformation UI 中手动执行 CF 中自动生成的 CF 模板。 When I tried and copied the Parameters section in and the Metadata section in, I got invalid syntax.
当我尝试复制参数部分和元数据部分时,我得到了无效的语法。
This led me to think amplify is using it's own parser to generate a finalized CF template and executing it in CF.这让我认为 amplify 是使用它自己的解析器来生成最终的 CF 模板并在 CF 中执行它。 I tried searching through the cli repo, but couldn't find it.
我尝试搜索 cli 存储库,但找不到。
A bit late but might still be useful.有点晚,但可能仍然有用。 You have a couple of questions here:
你在这里有几个问题:
Does anyone know which AuthRoleName file it's using?
有谁知道它使用的是哪个 AuthRoleName 文件? From what I read in the docs, both amplify-meta.json and team-provider-info.json is auto generated.
根据我在文档中读到的内容, amplify-meta.json 和 team-provider-info.json 都是自动生成的。
Yes, both are auto generated.是的,两者都是自动生成的。 The main difference being team-provider-info.json contains the parameters for all your amplify environments (assuming you have more that one and this file is shared between the team members) while amplify-meta.json contains only the info related to the currently checked out environment.
主要区别是 team-provider-info.json 包含所有放大环境的参数(假设您有多个环境并且此文件在团队成员之间共享),而 amplify-meta.json 仅包含与当前环境相关的信息检出环境。 In short, the values in amplify-meta.json are the ones currently used.
简而言之, amplify-meta.json 中的值是当前使用的值。
How does AWS Amplify cloudformation parameter.json work?
AWS Amplify cloudformation parameter.json 如何工作?
The way amplify works is by creating a cloudformation template for each function/api gateway/storage element (This is a partial list of Amplify Categories), each mini template will have its own parameters.json file (the one you mentioned). Amplify 的工作方式是为每个函数/api 网关/存储元素创建一个 cloudformation 模板(这是 Amplify Categories 的部分列表),每个迷你模板都有自己的 parameters.json 文件(你提到的那个)。 Then amplify will combine all of these files in a single template under amplify/backend/awscloudformation/nested-cloudformation-stack.yml (which is a json file!).
然后 amplify 会将所有这些文件合并到 amplify/backend/awscloudformation/nested-cloudformation-stack.yml(这是一个 json 文件!)下的单个模板中。 This file will have references to each template as they get uploaded into your deployment S3 bucket (can be found in amplify-meta.json) and the contents of the parameters.json files included inline.
此文件将引用每个模板,因为它们会上传到您的部署 S3 存储桶(可在 amplify-meta.json 中找到)以及内联包含的 parameters.json 文件的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.