policies
Creates, updates, deletes or gets a policy
resource or lists policies
in a region
Overview
Name | policies |
Type | Resource |
Description | Resource Type definition for AWS::IoT::Policy |
Id | aws.iot.policies |
Fields
Name | Datatype | Description |
---|---|---|
id | string | |
arn | string | |
policy_document | object | |
policy_name | string | |
tags | array | |
region | string | AWS region. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | PolicyDocument, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all policies
in a region.
SELECT
region,
id,
arn,
policy_document,
policy_name,
tags
FROM aws.iot.policies
WHERE region = 'us-east-1';
Gets all properties from an individual policy
.
SELECT
region,
id,
arn,
policy_document,
policy_name,
tags
FROM aws.iot.policies
WHERE region = 'us-east-1' AND data__Identifier = '<Id>';
INSERT
example
Use the following StackQL query and manifest file to create a new policy
resource, using stack-deploy
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.iot.policies (
PolicyDocument,
region
)
SELECT
'{{ PolicyDocument }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.iot.policies (
PolicyDocument,
PolicyName,
Tags,
region
)
SELECT
'{{ PolicyDocument }}',
'{{ PolicyName }}',
'{{ Tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: policy
props:
- name: PolicyDocument
value: {}
- name: PolicyName
value: '{{ PolicyName }}'
- name: Tags
value:
- Key: '{{ Key }}'
Value: '{{ Value }}'
DELETE
example
/*+ delete */
DELETE FROM aws.iot.policies
WHERE data__Identifier = '<Id>'
AND region = 'us-east-1';
Permissions
To operate on the policies
resource, the following permissions are required:
Create
iot:CreatePolicy,
iot:GetPolicy,
iot:TagResource,
iot:ListTagsForResource
Read
iot:GetPolicy,
iot:ListTagsForResource
Delete
iot:DeletePolicy,
iot:GetPolicy,
iot:ListPolicyVersions,
iot:DeletePolicyVersion
Update
iot:GetPolicy,
iot:ListPolicyVersions,
iot:CreatePolicyVersion,
iot:DeletePolicyVersion,
iot:SetDefaultPolicyVersion,
iot:TagResource,
iot:UntagResource,
iot:ListTagsForResource
List
iot:ListPolicies