amazon-web-services - 如何在CDK中获取AWS IoT自定义终端节点?

标签 amazon-web-services aws-lambda aws-cloudformation aws-cdk

我想将 IoT 自定义端点作为环境变量传递给 CDK 中声明的 lambda .

我正在谈论位于此处的 IoT 自定义端点: enter image description here

如何在 CDK 上下文中获取它?

最佳答案

您可以引用AWS示例代码: https://github.com/aws-samples/aws-iot-cqrs-example/blob/master/lib/querycommandcontainers.ts

const getIoTEndpoint = new customResource.AwsCustomResource(this, 'IoTEndpoint', {
            onCreate: {
              service: 'Iot',
              action: 'describeEndpoint',
              physicalResourceId: customResource.PhysicalResourceId.fromResponse('endpointAddress'),
              parameters: {
                "endpointType": "iot:Data-ATS"
              }
            },
            policy: customResource.AwsCustomResourcePolicy.fromSdkCalls({resources: customResource.AwsCustomResourcePolicy.ANY_RESOURCE})
          });

const IOT_ENDPOINT = getIoTEndpoint.getResponseField('endpointAddress')

关于amazon-web-services - 如何在CDK中获取AWS IoT自定义终端节点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60347716/

相关文章:

amazon-web-services - Amazon RDS Small 能否每秒对主键执行 200 次时间戳更新?

amazon-web-services - 如何重复使用 codepipeline 来部署不同的 lambda,而不替换现有的 lambda

java - 用于列出具有部分 uuid 的对象的 S3 前缀

amazon-web-services - S3 中的对象锁是否有助于防止对象被覆盖?

linux - 为什么我不能将文件夹上传到 Linux EC2 实例?

amazon-web-services - 如何调用也在 AWS SAM 模板中定义的另一个 lambda 函数?

amazon-web-services - 我们如何使用 Cloudformation 为 Lambda 设置动态变量

amazon-web-services - Aws Api Gateway Integration Request 如何将属性附加到请求正文?

file - 从文件部分选择文件的 CloudFormation 条件

aws-cloudformation - 如何为 AWS ElastiCache 创建子网?