我希望能够从 cloudformation 中调用 API 网关端点并解析来自输出的响应并将相关信息传递给 cloudformation 中的其他服务之一。
我有一个 api 端点
https://123x123x.execute-api.eu-west-2.amazonaws.com/myendpoint/tenants
和
x-api-key: b8Yk6m63rq8XRnMDKa2PeWE3KvBcU7ZyFIn0Vvrty
Content-Type: application/json
返回
{
"tenants": [
{
"tenantId": "tenant-1234",
"AZ": "us-west-2c",
"tenantUsers": 24,
"instanceType": "m1.small"
},
{
"tenantId": "tenant-2345",
"AZ": "us-west-2b",
"tenantUsers": 32,
"instanceType": "t2.micro"
},
{
"tenantId": "tenant-3456",
"AZ": "us-west-2a",
"tenantUsers": 12
"instanceType": "m1.large"
}
]}
我希望能够设置InstanceTypeParameter
需要["t2.micro", "m1.small", "m1.large"]
从上述响应中检索并作为参数传入 cloudformation 的列表,如下所示。
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"InstanceType" : { "Ref" : "InstanceTypeParameter" },
"ImageId" : "ami-0ff8a91507f77f867"
}
}
我假设这样做的唯一方法是使用自定义资源。有人可以帮我开发(至少是伪代码)吗?