boto3_iot¶
Manage IoT Objects using boto3.¶
Renamed from
boto_iottoboto3_iotand updated to call the refactoredboto3_iotexecution module.
Create and destroy IoT objects. Be aware that this interacts with Amazon’s services, and so may incur charges.
- depends:
boto3 >= 1.28.0
botocore >= 1.31.0
This module uses boto3, which can be installed via package, or pip.
This module accepts explicit IoT credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More Information available at:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
If IAM roles are not used you need to specify them either in the minion’s config file or as a profile. For example, to specify them in the minion’s config file:
iot.keyid: GKTADJGHEIQSXMKKRBJ08H
iot.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
It’s also possible to specify key, keyid and region via a profile, either as a passed in dict, or as a string to pull from pillars or minion config:
myprofile:
keyid: GKTADJGHEIQSXMKKRBJ08H
key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
region: us-east-1
Ensure policy exists:
boto3_iot.policy_present:
- policyName: mypolicy
- policyDocument:
Version: "2012-10-17"
Statement:
Action:
- iot:Publish
Resource:
- "*"
Effect: "Allow"
Ensure topic rule exists:
boto3_iot.topic_rule_present:
- ruleName: myrule
- sql: "SELECT * FROM 'iot/test'"
- description: 'test rule'
- ruleDisabled: false
- actions:
- lambda:
functionArn: "arn:aws:us-east-1:1234:function/functionname"
Added in version 1.0.0.
- saltext.boto3.states.boto3_iot.__virtual__()[source]¶
Only load if the boto3_iot execution module is available.
- saltext.boto3.states.boto3_iot.thing_type_present(name, thingTypeName, thingTypeDescription, searchableAttributesList, region=None, key=None, keyid=None, profile=None)[source]¶
Ensure thing type exists.
- name (string)
The name of the state declaration.
- thingTypeName (string)
The name of the thing type.
- thingTypeDescription (string)
The description of the thing type.
- searchableAttributesList (list)
A list of searchable attributes for the thing type.
- region (string)
Region to connect to.
- key (string)
Secret key to be used.
- keyid (string)
Access key to be used.
- profile (dict)
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Example:
ensure-thing-type-present: boto3_iot.thing_type_present: - thingTypeName: mythingtype - thingTypeDescription: 'My thing type description' - searchableAttributesList: - attribute1 - attribute2
- saltext.boto3.states.boto3_iot.thing_type_absent(name, thingTypeName, region=None, key=None, keyid=None, profile=None)[source]¶
Ensure thing type with passed properties is absent.
- name (string)
The name of the state declaration.
- thingTypeName (string)
The name of the thing type.
- region (string)
Region to connect to.
- key (string)
Secret key to be used.
- keyid (string)
Access key to be used.
- profile (dict)
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Example:
ensure-thing-type-absent: boto3_iot.thing_type_absent: - thingTypeName: mythingtype
- saltext.boto3.states.boto3_iot.policy_present(name, policyName, policyDocument, region=None, key=None, keyid=None, profile=None)[source]¶
Ensure policy exists.
- name (string)
The name of the state declaration.
- policyName (string)
The name of the policy.
- policyDocument (string)
The JSON document of the policy.
- region (string)
Region to connect to.
- key (string)
Secret key to be used.
- keyid (string)
Access key to be used.
- profile (dict)
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Example:
ensure-policy-present: boto3_iot.policy_present: - policyName: mypolicy - policyDocument: 'salt://path/to/policyDocument.json'
- saltext.boto3.states.boto3_iot.policy_absent(name, policyName, region=None, key=None, keyid=None, profile=None)[source]¶
Ensure policy with passed properties is absent.
- name (string)
The name of the state declaration.
- policyName (string)
The name of the policy.
- region (string)
Region to connect to.
- key (string)
Secret key to be used.
- keyid (string)
Access key to be used.
- profile (dict)
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Example:
ensure-policy-absent: boto3_iot.policy_absent: - policyName: mypolicy
- saltext.boto3.states.boto3_iot.policy_attached(name, policyName, principal, region=None, key=None, keyid=None, profile=None)[source]¶
Ensure policy is attached to the given principal.
Example:
ensure-policy-attached: boto3_iot.policy_attached: - name: example
- saltext.boto3.states.boto3_iot.policy_detached(name, policyName, principal, region=None, key=None, keyid=None, profile=None)[source]¶
Ensure policy is detached from the given principal.
- name (string)
The name of the state declaration.
- policyName (string)
The name of the policy.
- principal (string)
The principal from which the policy should be detached.
- region (string)
Region to connect to.
- key (string)
Secret key to be used.
- keyid (string)
Access key to be used.
- profile (dict)
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Example:
ensure-policy-detached: boto3_iot.policy_detached: - policyName: mypolicy - principal: myprincipal
- saltext.boto3.states.boto3_iot.topic_rule_present(name, ruleName, sql, actions, description='', ruleDisabled=False, region=None, key=None, keyid=None, profile=None)[source]¶
Ensure topic rule exists.
- name (string)
The name of the state declaration.
- ruleName (string)
The name of the topic rule.
- sql (string)
The SQL statement that defines the rule.
- actions (list)
The actions associated with the rule.
- description (string)
A description of the rule.
- ruleDisabled (bool)
Whether the rule is disabled.
- region (string)
Region to connect to.
- key (string)
Secret key to be used.
- keyid (string)
Access key to be used.
- profile (dict)
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Example:
ensure-topic-rule-present: boto3_iot.topic_rule_present: - ruleName: myrule - sql: "SELECT * FROM 'topic/test'" - actions: - lambda: functionArn: "arn:aws:lambda:us-west-2:123456789012:function:my-function" - description: "My test rule" - ruleDisabled: False
- saltext.boto3.states.boto3_iot.topic_rule_absent(name, ruleName, region=None, key=None, keyid=None, profile=None)[source]¶
Ensure topic rule with passed properties is absent.
- name (string)
The name of the state declaration.
- ruleName (string)
The name of the topic rule.
- region (string)
Region to connect to.
- key (string)
Secret key to be used.
- keyid (string)
Access key to be used.
- profile (dict)
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Example:
ensure-topic-rule-absent: boto3_iot.topic_rule_absent: - name: example - ruleName: myrule