topic_rules
Creates, updates, deletes or gets a topic_rule resource or lists topic_rules in a region
Overview
| Name | topic_rules |
| Type | Resource |
| Description | Resource Type definition for AWS::IoT::TopicRule |
| Id | awscc.iot.topic_rules |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
arn | string | |
rule_name | string | |
topic_rule_payload | object | |
tags | array | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
rule_name | string | |
region | string | AWS region. |
For more information, see AWS::IoT::TopicRule.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | topic_rules | INSERT | TopicRulePayload, region |
delete_resource | topic_rules | DELETE | Identifier, region |
update_resource | topic_rules | UPDATE | Identifier, PatchDocument, region |
list_resources | topic_rules_list_only | SELECT | region |
get_resource | topic_rules | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual topic_rule.
SELECT
region,
arn,
rule_name,
topic_rule_payload,
tags
FROM awscc.iot.topic_rules
WHERE
region = 'us-east-1' AND
Identifier = '{{ rule_name }}';
Lists all topic_rules in a region.
SELECT
region,
rule_name
FROM awscc.iot.topic_rules_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new topic_rule resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.iot.topic_rules (
TopicRulePayload,
region
)
SELECT
'{{ topic_rule_payload }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.iot.topic_rules (
RuleName,
TopicRulePayload,
Tags,
region
)
SELECT
'{{ rule_name }}',
'{{ topic_rule_payload }}',
'{{ tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: topic_rule
props:
- name: rule_name
value: '{{ rule_name }}'
- name: topic_rule_payload
value:
rule_disabled: '{{ rule_disabled }}'
error_action:
cloudwatch_alarm:
state_value: '{{ state_value }}'
alarm_name: '{{ alarm_name }}'
state_reason: '{{ state_reason }}'
role_arn: '{{ role_arn }}'
cloudwatch_logs:
log_group_name: '{{ log_group_name }}'
role_arn: '{{ role_arn }}'
batch_mode: '{{ batch_mode }}'
cloudwatch_metric:
metric_name: '{{ metric_name }}'
metric_value: '{{ metric_value }}'
metric_namespace: '{{ metric_namespace }}'
metric_unit: '{{ metric_unit }}'
role_arn: '{{ role_arn }}'
metric_timestamp: '{{ metric_timestamp }}'
dynamo_db:
table_name: '{{ table_name }}'
payload_field: '{{ payload_field }}'
range_key_field: '{{ range_key_field }}'
hash_key_field: '{{ hash_key_field }}'
range_key_value: '{{ range_key_value }}'
range_key_type: '{{ range_key_type }}'
hash_key_type: '{{ hash_key_type }}'
hash_key_value: '{{ hash_key_value }}'
role_arn: '{{ role_arn }}'
dynamo_dbv2:
put_item:
table_name: '{{ table_name }}'
role_arn: '{{ role_arn }}'
elasticsearch:
type: '{{ type }}'
index: '{{ index }}'
id: '{{ id }}'
endpoint: '{{ endpoint }}'
role_arn: '{{ role_arn }}'
firehose:
delivery_stream_name: '{{ delivery_stream_name }}'
role_arn: '{{ role_arn }}'
separator: '{{ separator }}'
batch_mode: '{{ batch_mode }}'
http:
confirmation_url: '{{ confirmation_url }}'
headers:
- value: '{{ value }}'
key: '{{ key }}'
url: '{{ url }}'
auth:
sigv4:
service_name: '{{ service_name }}'
signing_region: '{{ signing_region }}'
role_arn: '{{ role_arn }}'
iot_analytics:
role_arn: '{{ role_arn }}'
channel_name: '{{ channel_name }}'
batch_mode: '{{ batch_mode }}'
iot_events:
input_name: '{{ input_name }}'
role_arn: '{{ role_arn }}'
message_id: '{{ message_id }}'
batch_mode: '{{ batch_mode }}'
iot_site_wise:
role_arn: '{{ role_arn }}'
put_asset_property_value_entries:
- property_alias: '{{ property_alias }}'
property_values:
- value:
string_value: '{{ string_value }}'
double_value: '{{ double_value }}'
boolean_value: '{{ boolean_value }}'
integer_value: '{{ integer_value }}'
timestamp:
time_in_seconds: '{{ time_in_seconds }}'
offset_in_nanos: '{{ offset_in_nanos }}'
quality: '{{ quality }}'
asset_id: '{{ asset_id }}'
entry_id: '{{ entry_id }}'
property_id: '{{ property_id }}'
kafka:
destination_arn: '{{ destination_arn }}'
topic: '{{ topic }}'
key: '{{ key }}'
partition: '{{ partition }}'
client_properties: {}
headers:
- value: '{{ value }}'
key: '{{ key }}'
kinesis:
partition_key: '{{ partition_key }}'
stream_name: '{{ stream_name }}'
role_arn: '{{ role_arn }}'
lambda:
function_arn: '{{ function_arn }}'
location:
role_arn: '{{ role_arn }}'
tracker_name: '{{ tracker_name }}'
device_id: '{{ device_id }}'
latitude: '{{ latitude }}'
longitude: '{{ longitude }}'
timestamp:
value: '{{ value }}'
unit: '{{ unit }}'
open_search:
type: '{{ type }}'
index: '{{ index }}'
id: '{{ id }}'
endpoint: '{{ endpoint }}'
role_arn: '{{ role_arn }}'
republish:
qos: '{{ qos }}'
topic: '{{ topic }}'
role_arn: '{{ role_arn }}'
headers:
payload_format_indicator: '{{ payload_format_indicator }}'
content_type: '{{ content_type }}'
response_topic: '{{ response_topic }}'
correlation_data: '{{ correlation_data }}'
message_expiry: '{{ message_expiry }}'
user_properties:
- key: '{{ key }}'
value: '{{ value }}'
s3:
bucket_name: '{{ bucket_name }}'
key: '{{ key }}'
role_arn: '{{ role_arn }}'
canned_acl: '{{ canned_acl }}'
sns:
target_arn: '{{ target_arn }}'
message_format: '{{ message_format }}'
role_arn: '{{ role_arn }}'
sqs:
role_arn: '{{ role_arn }}'
use_base64: '{{ use_base64 }}'
queue_url: '{{ queue_url }}'
step_functions:
execution_name_prefix: '{{ execution_name_prefix }}'
state_machine_name: '{{ state_machine_name }}'
role_arn: '{{ role_arn }}'
timestream:
role_arn: '{{ role_arn }}'
database_name: '{{ database_name }}'
table_name: '{{ table_name }}'
dimensions:
- name: '{{ name }}'
value: '{{ value }}'
timestamp:
value: '{{ value }}'
unit: '{{ unit }}'
description: '{{ description }}'
aws_iot_sql_version: '{{ aws_iot_sql_version }}'
actions:
- null
sql: '{{ sql }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a topic_rule resource, using stack-deploy.
/*+ update */
UPDATE awscc.iot.topic_rules
SET PatchDocument = string('{{ {
"TopicRulePayload": topic_rule_payload,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ rule_name }}';
DELETE example
/*+ delete */
DELETE FROM awscc.iot.topic_rules
WHERE
Identifier = '{{ rule_name }}' AND
region = 'us-east-1';
Permissions
To operate on the topic_rules resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
iam:PassRole,
iot:CreateTopicRule,
iot:GetTopicRule,
iot:TagResource,
iot:ListTagsForResource
iot:GetTopicRule,
iot:ListTagsForResource
iam:PassRole,
iot:GetTopicRule,
iot:ListTagsForResource,
iot:ReplaceTopicRule,
iot:TagResource,
iot:UntagResource
iot:GetTopicRule,
iot:DeleteTopicRule
iot:ListTopicRules