Skip to main content

resource_policies

Creates, updates, deletes, gets or lists a resource_policies resource.

Overview

Nameresource_policies
TypeResource
Idaws.logs.resource_policies

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
last_updated_timeinteger (int64)Timestamp showing when this policy was last updated, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
policy_documentstringThe details of the policy.
policy_namestringThe name of the resource policy.
policy_scopestringSpecifies scope of the resource policy. Valid values are ACCOUNT or RESOURCE. (ACCOUNT, RESOURCE)
resource_arnstringThe ARN of the CloudWatch Logs resource to which the resource policy is attached. Only populated for resource-scoped policies.
revision_idstringThe revision ID of the resource policy. Only populated for resource-scoped policies.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_resource_policiesselectregionLists the resource policies in this account.
put_resource_policyreplaceregionCreates or updates a resource policy allowing other Amazon Web Services services to put log events to this account, such as Amazon Route 53. This API has the following restrictions: Supported actions - Policy only supports logs:PutLogEvents and logs:CreateLogStream actions Supported principals - Policy only applies when operations are invoked by Amazon Web Services service principals (not IAM users, roles, or cross-account principals Policy limits - An account can have a maximum of 10 policies without resourceARN and one per LogGroup resourceARN Resource policies with actions invoked by non-Amazon Web Services service principals (such as IAM users, roles, or other Amazon Web Services accounts) will not be enforced. For access control involving these principals, use the IAM policies.
delete_resource_policydeleteregionDeletes a resource policy from this account. This revokes the access of the identities in that policy to put log events to this account.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Lists the resource policies in this account.

SELECT
last_updated_time,
policy_document,
policy_name,
policy_scope,
resource_arn,
revision_id
FROM aws.logs.resource_policies
WHERE region = '{{ region }}' -- required
;

REPLACE examples

Creates or updates a resource policy allowing other Amazon Web Services services to put log events to this account, such as Amazon Route 53. This API has the following restrictions: Supported actions - Policy only supports logs:PutLogEvents and logs:CreateLogStream actions Supported principals - Policy only applies when operations are invoked by Amazon Web Services service principals (not IAM users, roles, or cross-account principals Policy limits - An account can have a maximum of 10 policies without resourceARN and one per LogGroup resourceARN Resource policies with actions invoked by non-Amazon Web Services service principals (such as IAM users, roles, or other Amazon Web Services accounts) will not be enforced. For access control involving these principals, use the IAM policies.

REPLACE aws.logs.resource_policies
SET
policyName = '{{ policyName }}',
policyDocument = '{{ policyDocument }}',
resourceArn = '{{ resourceArn }}',
expectedRevisionId = '{{ expectedRevisionId }}'
WHERE
region = '{{ region }}' --required
RETURNING
resource_policy,
revision_id;

DELETE examples

Deletes a resource policy from this account. This revokes the access of the identities in that policy to put log events to this account.

DELETE FROM aws.logs.resource_policies
WHERE region = '{{ region }}' --required
;