Trouble creating tags for IoT policies using CDK

0

Something like the following does not work for me, but it does if I change the construct from an IoT policy construct to, say, an S3 bucket construct.

cdk.Tags.of(iotPolicy).add('Name', 'Value');

Hope this explanation is enough to work on. If not, please let me know.

Thanks Gary

2回答
1
承認された回答

Hi Gary. The underlying issue is that CloudFormation has a tags property for S3 buckets, but it doesn't have a tags property for IoT policies. I can't find any specific discussion about tags for IoT policies, but here's a similar issue for IAM Managed Policies: https://github.com/aws-cloudformation/cloudformation-coverage-roadmap/issues/819

profile pictureAWS
エキスパート
Greg_B
回答済み 1年前
profile picture
エキスパート
レビュー済み 7日前
profile picture
エキスパート
レビュー済み 1ヶ月前
  • Hi Greg, I can tag an IoT policy using the console but I accept that the coverage isn't there. Thanks.

0

To add onto Greg's response, most AWS IoT resources can be tagged, but it has to happen after the resource has been created. Also note that AWS IoT Things and Certificates are resources than cannot be tagged at present.

Once a resource has been created, the TagResource API can be called to apply tags for use in IAM ABAC, cost allocation, etc. Via CDK this could be accomplished by creating a level 2 or 3 construct that takes in the Arn of created resource along with the key value pairs of the tags, then use a custom resource to make the needed API call(s).

AWS
Gavin_A
回答済み 1年前
profile picture
エキスパート
レビュー済み 1ヶ月前
  • Thanks Gavin

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ