1. Packages
  2. AWS
  3. API Docs
  4. iot
  5. ThingGroup
AWS v6.73.0 published on Wednesday, Mar 19, 2025 by Pulumi

aws.iot.ThingGroup

Explore with Pulumi AI

Manages an AWS IoT Thing Group.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const parent = new aws.iot.ThingGroup("parent", {name: "parent"});
const example = new aws.iot.ThingGroup("example", {
    name: "example",
    parentGroupName: parent.name,
    properties: {
        attributePayload: {
            attributes: {
                One: "11111",
                Two: "TwoTwo",
            },
        },
        description: "This is my thing group",
    },
    tags: {
        managed: "true",
    },
});
Copy
import pulumi
import pulumi_aws as aws

parent = aws.iot.ThingGroup("parent", name="parent")
example = aws.iot.ThingGroup("example",
    name="example",
    parent_group_name=parent.name,
    properties={
        "attribute_payload": {
            "attributes": {
                "One": "11111",
                "Two": "TwoTwo",
            },
        },
        "description": "This is my thing group",
    },
    tags={
        "managed": "true",
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iot"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		parent, err := iot.NewThingGroup(ctx, "parent", &iot.ThingGroupArgs{
			Name: pulumi.String("parent"),
		})
		if err != nil {
			return err
		}
		_, err = iot.NewThingGroup(ctx, "example", &iot.ThingGroupArgs{
			Name:            pulumi.String("example"),
			ParentGroupName: parent.Name,
			Properties: &iot.ThingGroupPropertiesArgs{
				AttributePayload: &iot.ThingGroupPropertiesAttributePayloadArgs{
					Attributes: pulumi.StringMap{
						"One": pulumi.String("11111"),
						"Two": pulumi.String("TwoTwo"),
					},
				},
				Description: pulumi.String("This is my thing group"),
			},
			Tags: pulumi.StringMap{
				"managed": pulumi.String("true"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var parent = new Aws.Iot.ThingGroup("parent", new()
    {
        Name = "parent",
    });

    var example = new Aws.Iot.ThingGroup("example", new()
    {
        Name = "example",
        ParentGroupName = parent.Name,
        Properties = new Aws.Iot.Inputs.ThingGroupPropertiesArgs
        {
            AttributePayload = new Aws.Iot.Inputs.ThingGroupPropertiesAttributePayloadArgs
            {
                Attributes = 
                {
                    { "One", "11111" },
                    { "Two", "TwoTwo" },
                },
            },
            Description = "This is my thing group",
        },
        Tags = 
        {
            { "managed", "true" },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iot.ThingGroup;
import com.pulumi.aws.iot.ThingGroupArgs;
import com.pulumi.aws.iot.inputs.ThingGroupPropertiesArgs;
import com.pulumi.aws.iot.inputs.ThingGroupPropertiesAttributePayloadArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var parent = new ThingGroup("parent", ThingGroupArgs.builder()
            .name("parent")
            .build());

        var example = new ThingGroup("example", ThingGroupArgs.builder()
            .name("example")
            .parentGroupName(parent.name())
            .properties(ThingGroupPropertiesArgs.builder()
                .attributePayload(ThingGroupPropertiesAttributePayloadArgs.builder()
                    .attributes(Map.ofEntries(
                        Map.entry("One", "11111"),
                        Map.entry("Two", "TwoTwo")
                    ))
                    .build())
                .description("This is my thing group")
                .build())
            .tags(Map.of("managed", "true"))
            .build());

    }
}
Copy
resources:
  parent:
    type: aws:iot:ThingGroup
    properties:
      name: parent
  example:
    type: aws:iot:ThingGroup
    properties:
      name: example
      parentGroupName: ${parent.name}
      properties:
        attributePayload:
          attributes:
            One: '11111'
            Two: TwoTwo
        description: This is my thing group
      tags:
        managed: 'true'
Copy

Create ThingGroup Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ThingGroup(name: string, args?: ThingGroupArgs, opts?: CustomResourceOptions);
@overload
def ThingGroup(resource_name: str,
               args: Optional[ThingGroupArgs] = None,
               opts: Optional[ResourceOptions] = None)

@overload
def ThingGroup(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               name: Optional[str] = None,
               parent_group_name: Optional[str] = None,
               properties: Optional[ThingGroupPropertiesArgs] = None,
               tags: Optional[Mapping[str, str]] = None)
func NewThingGroup(ctx *Context, name string, args *ThingGroupArgs, opts ...ResourceOption) (*ThingGroup, error)
public ThingGroup(string name, ThingGroupArgs? args = null, CustomResourceOptions? opts = null)
public ThingGroup(String name, ThingGroupArgs args)
public ThingGroup(String name, ThingGroupArgs args, CustomResourceOptions options)
type: aws:iot:ThingGroup
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args ThingGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args ThingGroupArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args ThingGroupArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args ThingGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ThingGroupArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var thingGroupResource = new Aws.Iot.ThingGroup("thingGroupResource", new()
{
    Name = "string",
    ParentGroupName = "string",
    Properties = new Aws.Iot.Inputs.ThingGroupPropertiesArgs
    {
        AttributePayload = new Aws.Iot.Inputs.ThingGroupPropertiesAttributePayloadArgs
        {
            Attributes = 
            {
                { "string", "string" },
            },
        },
        Description = "string",
    },
    Tags = 
    {
        { "string", "string" },
    },
});
Copy
example, err := iot.NewThingGroup(ctx, "thingGroupResource", &iot.ThingGroupArgs{
	Name:            pulumi.String("string"),
	ParentGroupName: pulumi.String("string"),
	Properties: &iot.ThingGroupPropertiesArgs{
		AttributePayload: &iot.ThingGroupPropertiesAttributePayloadArgs{
			Attributes: pulumi.StringMap{
				"string": pulumi.String("string"),
			},
		},
		Description: pulumi.String("string"),
	},
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
Copy
var thingGroupResource = new ThingGroup("thingGroupResource", ThingGroupArgs.builder()
    .name("string")
    .parentGroupName("string")
    .properties(ThingGroupPropertiesArgs.builder()
        .attributePayload(ThingGroupPropertiesAttributePayloadArgs.builder()
            .attributes(Map.of("string", "string"))
            .build())
        .description("string")
        .build())
    .tags(Map.of("string", "string"))
    .build());
Copy
thing_group_resource = aws.iot.ThingGroup("thingGroupResource",
    name="string",
    parent_group_name="string",
    properties={
        "attribute_payload": {
            "attributes": {
                "string": "string",
            },
        },
        "description": "string",
    },
    tags={
        "string": "string",
    })
Copy
const thingGroupResource = new aws.iot.ThingGroup("thingGroupResource", {
    name: "string",
    parentGroupName: "string",
    properties: {
        attributePayload: {
            attributes: {
                string: "string",
            },
        },
        description: "string",
    },
    tags: {
        string: "string",
    },
});
Copy
type: aws:iot:ThingGroup
properties:
    name: string
    parentGroupName: string
    properties:
        attributePayload:
            attributes:
                string: string
        description: string
    tags:
        string: string
Copy

ThingGroup Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ThingGroup resource accepts the following input properties:

Name Changes to this property will trigger replacement. string
The name of the Thing Group.
ParentGroupName Changes to this property will trigger replacement. string
The name of the parent Thing Group.
Properties ThingGroupProperties
The Thing Group properties. Defined below.
Tags Dictionary<string, string>
Key-value mapping of resource tags
Name Changes to this property will trigger replacement. string
The name of the Thing Group.
ParentGroupName Changes to this property will trigger replacement. string
The name of the parent Thing Group.
Properties ThingGroupPropertiesArgs
The Thing Group properties. Defined below.
Tags map[string]string
Key-value mapping of resource tags
name Changes to this property will trigger replacement. String
The name of the Thing Group.
parentGroupName Changes to this property will trigger replacement. String
The name of the parent Thing Group.
properties ThingGroupProperties
The Thing Group properties. Defined below.
tags Map<String,String>
Key-value mapping of resource tags
name Changes to this property will trigger replacement. string
The name of the Thing Group.
parentGroupName Changes to this property will trigger replacement. string
The name of the parent Thing Group.
properties ThingGroupProperties
The Thing Group properties. Defined below.
tags {[key: string]: string}
Key-value mapping of resource tags
name Changes to this property will trigger replacement. str
The name of the Thing Group.
parent_group_name Changes to this property will trigger replacement. str
The name of the parent Thing Group.
properties ThingGroupPropertiesArgs
The Thing Group properties. Defined below.
tags Mapping[str, str]
Key-value mapping of resource tags
name Changes to this property will trigger replacement. String
The name of the Thing Group.
parentGroupName Changes to this property will trigger replacement. String
The name of the parent Thing Group.
properties Property Map
The Thing Group properties. Defined below.
tags Map<String>
Key-value mapping of resource tags

Outputs

All input properties are implicitly available as output properties. Additionally, the ThingGroup resource produces the following output properties:

Arn string
The ARN of the Thing Group.
Id string
The provider-assigned unique ID for this managed resource.
Metadatas List<ThingGroupMetadata>
TagsAll Dictionary<string, string>

Deprecated: Please use tags instead.

Version int
The current version of the Thing Group record in the registry.
Arn string
The ARN of the Thing Group.
Id string
The provider-assigned unique ID for this managed resource.
Metadatas []ThingGroupMetadata
TagsAll map[string]string

Deprecated: Please use tags instead.

Version int
The current version of the Thing Group record in the registry.
arn String
The ARN of the Thing Group.
id String
The provider-assigned unique ID for this managed resource.
metadatas List<ThingGroupMetadata>
tagsAll Map<String,String>

Deprecated: Please use tags instead.

version Integer
The current version of the Thing Group record in the registry.
arn string
The ARN of the Thing Group.
id string
The provider-assigned unique ID for this managed resource.
metadatas ThingGroupMetadata[]
tagsAll {[key: string]: string}

Deprecated: Please use tags instead.

version number
The current version of the Thing Group record in the registry.
arn str
The ARN of the Thing Group.
id str
The provider-assigned unique ID for this managed resource.
metadatas Sequence[ThingGroupMetadata]
tags_all Mapping[str, str]

Deprecated: Please use tags instead.

version int
The current version of the Thing Group record in the registry.
arn String
The ARN of the Thing Group.
id String
The provider-assigned unique ID for this managed resource.
metadatas List<Property Map>
tagsAll Map<String>

Deprecated: Please use tags instead.

version Number
The current version of the Thing Group record in the registry.

Look up Existing ThingGroup Resource

Get an existing ThingGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ThingGroupState, opts?: CustomResourceOptions): ThingGroup
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        metadatas: Optional[Sequence[ThingGroupMetadataArgs]] = None,
        name: Optional[str] = None,
        parent_group_name: Optional[str] = None,
        properties: Optional[ThingGroupPropertiesArgs] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None,
        version: Optional[int] = None) -> ThingGroup
func GetThingGroup(ctx *Context, name string, id IDInput, state *ThingGroupState, opts ...ResourceOption) (*ThingGroup, error)
public static ThingGroup Get(string name, Input<string> id, ThingGroupState? state, CustomResourceOptions? opts = null)
public static ThingGroup get(String name, Output<String> id, ThingGroupState state, CustomResourceOptions options)
resources:  _:    type: aws:iot:ThingGroup    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Arn string
The ARN of the Thing Group.
Metadatas List<ThingGroupMetadata>
Name Changes to this property will trigger replacement. string
The name of the Thing Group.
ParentGroupName Changes to this property will trigger replacement. string
The name of the parent Thing Group.
Properties ThingGroupProperties
The Thing Group properties. Defined below.
Tags Dictionary<string, string>
Key-value mapping of resource tags
TagsAll Dictionary<string, string>

Deprecated: Please use tags instead.

Version int
The current version of the Thing Group record in the registry.
Arn string
The ARN of the Thing Group.
Metadatas []ThingGroupMetadataArgs
Name Changes to this property will trigger replacement. string
The name of the Thing Group.
ParentGroupName Changes to this property will trigger replacement. string
The name of the parent Thing Group.
Properties ThingGroupPropertiesArgs
The Thing Group properties. Defined below.
Tags map[string]string
Key-value mapping of resource tags
TagsAll map[string]string

Deprecated: Please use tags instead.

Version int
The current version of the Thing Group record in the registry.
arn String
The ARN of the Thing Group.
metadatas List<ThingGroupMetadata>
name Changes to this property will trigger replacement. String
The name of the Thing Group.
parentGroupName Changes to this property will trigger replacement. String
The name of the parent Thing Group.
properties ThingGroupProperties
The Thing Group properties. Defined below.
tags Map<String,String>
Key-value mapping of resource tags
tagsAll Map<String,String>

Deprecated: Please use tags instead.

version Integer
The current version of the Thing Group record in the registry.
arn string
The ARN of the Thing Group.
metadatas ThingGroupMetadata[]
name Changes to this property will trigger replacement. string
The name of the Thing Group.
parentGroupName Changes to this property will trigger replacement. string
The name of the parent Thing Group.
properties ThingGroupProperties
The Thing Group properties. Defined below.
tags {[key: string]: string}
Key-value mapping of resource tags
tagsAll {[key: string]: string}

Deprecated: Please use tags instead.

version number
The current version of the Thing Group record in the registry.
arn str
The ARN of the Thing Group.
metadatas Sequence[ThingGroupMetadataArgs]
name Changes to this property will trigger replacement. str
The name of the Thing Group.
parent_group_name Changes to this property will trigger replacement. str
The name of the parent Thing Group.
properties ThingGroupPropertiesArgs
The Thing Group properties. Defined below.
tags Mapping[str, str]
Key-value mapping of resource tags
tags_all Mapping[str, str]

Deprecated: Please use tags instead.

version int
The current version of the Thing Group record in the registry.
arn String
The ARN of the Thing Group.
metadatas List<Property Map>
name Changes to this property will trigger replacement. String
The name of the Thing Group.
parentGroupName Changes to this property will trigger replacement. String
The name of the parent Thing Group.
properties Property Map
The Thing Group properties. Defined below.
tags Map<String>
Key-value mapping of resource tags
tagsAll Map<String>

Deprecated: Please use tags instead.

version Number
The current version of the Thing Group record in the registry.

Supporting Types

ThingGroupMetadata
, ThingGroupMetadataArgs

creationDate String
parentGroupName String
The name of the parent Thing Group.
rootToParentGroups List<Property Map>

ThingGroupMetadataRootToParentGroup
, ThingGroupMetadataRootToParentGroupArgs

GroupArn string
GroupName string
GroupArn string
GroupName string
groupArn String
groupName String
groupArn string
groupName string
groupArn String
groupName String

ThingGroupProperties
, ThingGroupPropertiesArgs

AttributePayload ThingGroupPropertiesAttributePayload
The Thing Group attributes. Defined below.
Description string
A description of the Thing Group.
AttributePayload ThingGroupPropertiesAttributePayload
The Thing Group attributes. Defined below.
Description string
A description of the Thing Group.
attributePayload ThingGroupPropertiesAttributePayload
The Thing Group attributes. Defined below.
description String
A description of the Thing Group.
attributePayload ThingGroupPropertiesAttributePayload
The Thing Group attributes. Defined below.
description string
A description of the Thing Group.
attribute_payload ThingGroupPropertiesAttributePayload
The Thing Group attributes. Defined below.
description str
A description of the Thing Group.
attributePayload Property Map
The Thing Group attributes. Defined below.
description String
A description of the Thing Group.

ThingGroupPropertiesAttributePayload
, ThingGroupPropertiesAttributePayloadArgs

Attributes Dictionary<string, string>
Key-value map.
Attributes map[string]string
Key-value map.
attributes Map<String,String>
Key-value map.
attributes {[key: string]: string}
Key-value map.
attributes Mapping[str, str]
Key-value map.
attributes Map<String>
Key-value map.

Import

Using pulumi import, import IoT Things Groups using the name. For example:

$ pulumi import aws:iot/thingGroup:ThingGroup example example
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.