Seleccione sus preferencias de cookies

Usamos cookies esenciales y herramientas similares que son necesarias para proporcionar nuestro sitio y nuestros servicios. Usamos cookies de rendimiento para recopilar estadísticas anónimas para que podamos entender cómo los clientes usan nuestro sitio y hacer mejoras. Las cookies esenciales no se pueden desactivar, pero puede hacer clic en “Personalizar” o “Rechazar” para rechazar las cookies de rendimiento.

Si está de acuerdo, AWS y los terceros aprobados también utilizarán cookies para proporcionar características útiles del sitio, recordar sus preferencias y mostrar contenido relevante, incluida publicidad relevante. Para aceptar o rechazar todas las cookies no esenciales, haga clic en “Aceptar” o “Rechazar”. Para elegir opciones más detalladas, haga clic en “Personalizar”.

AWS::IoT::TopicRule

Modo de enfoque
AWS::IoT::TopicRule - AWS CloudFormation
Esta página no se ha traducido a su idioma. Solicitar traducción
Filtrar vista

Use the AWS::IoT::TopicRule resource to declare an AWS IoT rule. For information about working with AWS IoT rules, see Rules for AWS IoT in the AWS IoT Developer Guide.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::IoT::TopicRule", "Properties" : { "RuleName" : String, "Tags" : [ Tag, ... ], "TopicRulePayload" : TopicRulePayload } }

YAML

Type: AWS::IoT::TopicRule Properties: RuleName: String Tags: - Tag TopicRulePayload: TopicRulePayload

Properties

RuleName

The name of the rule.

Required: No

Type: String

Pattern: ^[a-zA-Z0-9_]+$

Minimum: 1

Maximum: 128

Update requires: Replacement

Tags

Metadata which can be used to manage the topic rule.

Note

For URI Request parameters use format: ...key1=value1&key2=value2...

For the CLI command-line parameter use format: --tags "key1=value1&key2=value2..."

For the cli-input-json file use format: "tags": "key1=value1&key2=value2..."

Required: No

Type: Array of Tag

Update requires: No interruption

TopicRulePayload

The rule payload.

Required: Yes

Type: TopicRulePayload

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the topic rule name. For example:

{ "Ref": "MyTopicRule" }

For a stack named My-Stack (the - character is omitted), a value similar to the following is returned:

MyStackMyTopicRule12ABC3D456EFG

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

Arn

The Amazon Resource Name (ARN) of the AWS IoT rule, such as arn:aws:iot:us-east-2:123456789012:rule/MyIoTRule.

Examples

The following example declares an AWS IoT rule.

JSON

{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "MyTopicRule": { "Type": "AWS::IoT::TopicRule", "Properties": { "RuleName": { "Ref": "NameParameter" }, "TopicRulePayload": { "RuleDisabled": "true", "Sql": "SELECT temp FROM 'SomeTopic' WHERE temp > 60", "Actions": [{ "S3": { "BucketName": { "Ref": "amzn-s3-demo-bucket" }, "RoleArn": { "Fn::GetAtt": [ "MyRole", "Arn" ] }, "Key": "MyKey.txt" } }] } } } } }

YAML

AWSTemplateFormatVersion: '2010-09-09' Resources: MyTopicRule: Type: AWS::IoT::TopicRule Properties: RuleName: Ref: NameParameter TopicRulePayload: RuleDisabled: 'true' Sql: SELECT temp FROM 'SomeTopic' WHERE temp > 60 Actions: - S3: BucketName: Ref: amzn-s3-demo-bucket RoleArn: Fn::GetAtt: - MyRole - Arn Key: MyKey.txt

En esta página

PrivacidadTérminos del sitioPreferencias de cookies
© 2025, Amazon Web Services, Inc o sus afiliados. Todos los derechos reservados.