AWS IoT Policy Attachment

This page shows how to write Terraform and CloudFormation for AWS IoT Policy Attachment and write them securely.

aws_iot_policy_attachment (Terraform)

The Policy Attachment in AWS IoT can be configured in Terraform with the resource name aws_iot_policy_attachment. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

iot_things.tf#L30
resource "aws_iot_policy_attachment" "air-pollution-iot" {
  policy = aws_iot_policy.iot.name
  target = aws_iot_certificate.air-pollution.arn
}

resource "aws_iot_policy_attachment" "air-pollution-kinesis" {
main.tf#L16
resource "aws_iot_policy_attachment" "pol_attach" {
  policy = var.policy
  target = aws_iot_certificate.cert.arn
}
main.tf#L16
resource "aws_iot_policy_attachment" "pol_attach" {
  policy = var.policy
  target = aws_iot_certificate.cert.arn
}
iot_policy.tf#L33
resource "aws_iot_policy_attachment" "att" {
  policy = aws_iot_policy.pubsub.name
  target = aws_iot_certificate.cert.arn
}
policy.tf#L7
resource "aws_iot_policy_attachment" "thing_policy_attachment" {
  policy = aws_iot_policy.tf_policy.name
  target = aws_iot_certificate.things_cert.arn
}

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides an IoT policy attachment.

AWS::IoT::ThingPrincipalAttachment (CloudFormation)

The ThingPrincipalAttachment in IoT can be configured in CloudFormation with the resource name AWS::IoT::ThingPrincipalAttachment. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Explanation in CloudFormation Registry

Use the AWS::IoT::ThingPrincipalAttachment resource to attach a principal (an X.

509 certificate or another credential) to a thing.

For more information about working with AWS IoT things and principals, see Authorization in the AWS IoT Developer Guide.

Frequently asked questions

What is AWS IoT Policy Attachment?

AWS IoT Policy Attachment is a resource for IoT of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS IoT Policy Attachment?

For Terraform, the luismayta/iot-air-pollution, j0rzsh/aws-iot-meetup and j0rzsh/aws-iot-tfg source code examples are useful. See the Terraform Example section for further details.