Skip to main content

permissions

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

Overview

Namepermissions
TypeResource
Idaws.ram.permissions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of this permission.
arnstringThe Amazon Resource Name (ARN) of this RAM managed permission.
creation_timestring (date-time)The date and time when the permission was created.
default_versionbooleanSpecifies whether the version of the permission represented in this response is the default version for this permission.
feature_setstringIndicates what features are available for this resource share. This parameter can have one of the following values: STANDARD – A resource share that supports all functionality. These resource shares are visible to all principals you share the resource share with. You can modify these resource shares in RAM using the console or APIs. This resource share might have been created by RAM, or it might have been CREATED_FROM_POLICY and then promoted. CREATED_FROM_POLICY – The customer manually shared a resource by attaching a resource-based policy. That policy did not match any existing managed permissions, so RAM created this customer managed permission automatically on the customer's behalf based on the attached policy document. This type of resource share is visible only to the Amazon Web Services account that created it. You can't modify it in RAM unless you promote it. For more information, see PromoteResourceShareCreatedFromPolicy. PROMOTING_TO_STANDARD – This resource share was originally CREATED_FROM_POLICY, but the customer ran the PromoteResourceShareCreatedFromPolicy and that operation is still in progress. This value changes to STANDARD when complete. (CREATED_FROM_POLICY, PROMOTING_TO_STANDARD, STANDARD)
is_resource_type_defaultbooleanSpecifies whether the version of the permission represented in this response is the default version for all resources of this resource type.
last_updated_timestring (date-time)The date and time when the permission was last updated.
permissionstringThe permission's effect and actions in JSON format. The effect indicates whether the specified actions are allowed or denied. The actions list the operations to which the principal is granted or denied access.
permission_typestringThe type of managed permission. This can be one of the following values: AWS_MANAGED – Amazon Web Services created and manages this managed permission. You can associate it with your resource shares, but you can't modify it. CUSTOMER_MANAGED – You, or another principal in your account created this managed permission. You can associate it with your resource shares and create new versions that have different permissions. (CUSTOMER_MANAGED, AWS_MANAGED)
resource_typestringThe resource type to which this permission applies.
statusstringThe current status of the association between the permission and the resource share. The following are the possible values: ATTACHABLE – This permission or version can be associated with resource shares. UNATTACHABLE – This permission or version can't currently be associated with resource shares. DELETING – This permission or version is in the process of being deleted. DELETED – This permission or version is deleted. (ATTACHABLE, UNATTACHABLE, DELETING, DELETED)
tagsarrayThe tag key and value pairs attached to the resource share.
versionstringThe version of the permission described in this response.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_permissionselectregionRetrieves the contents of a managed permission in JSON format.
list_permissionsselectregionRetrieves a list of available RAM permissions that you can use for the supported resource types. Always check the NextToken response parameter for a null value when calling a paginated operation. These operations can occasionally return an empty set of results even when there are more results available. The NextToken response parameter value is null only when there are no more results to display.
create_permissioninsertregion, name, resourceType, policyTemplateCreates a customer managed permission for a specified resource type that you can attach to resource shares. It is created in the Amazon Web Services Region in which you call the operation.
delete_permissiondeletepermissionArn, regionclientTokenDeletes the specified customer managed permission in the Amazon Web Services Region in which you call this operation. You can delete a customer managed permission only if it isn't attached to any resource share. The operation deletes all versions associated with the customer managed permission.
promote_permission_created_from_policyexecregion, permissionArn, nameWhen you attach a resource-based policy to a resource, RAM automatically creates a resource share of featureSet=CREATED_FROM_POLICY with a managed permission that has the same IAM permissions as the original resource-based policy. However, this type of managed permission is visible to only the resource share owner, and the associated resource share can't be modified by using RAM. This operation creates a separate, fully manageable customer managed permission that has the same IAM permissions as the original resource-based policy. You can associate this customer managed permission to any resource shares. Before you use PromoteResourceShareCreatedFromPolicy, you should first run this operation to ensure that you have an appropriate customer managed permission that can be associated with the promoted resource share. The original CREATED_FROM_POLICY policy isn't deleted, and resource shares using that original policy aren't automatically updated. You can't modify a CREATED_FROM_POLICY resource share so you can't associate the new customer managed permission by using ReplacePermsissionAssociations. However, if you use PromoteResourceShareCreatedFromPolicy, that operation automatically associates the fully manageable customer managed permission to the newly promoted STANDARD resource share. After you promote a resource share, if the original CREATED_FROM_POLICY managed permission has no other associations to A resource share, then RAM automatically deletes it.

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
permissionArnstringSpecifies the Amazon Resource Name (ARN) of the customer managed permission that you want to delete.
regionstringAWS region (default: us-east-1)
clientTokenstringSpecifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a UUID type of value.. If you don't provide this value, then Amazon Web Services generates a random one for you. If you retry the operation with the same ClientToken, but with different parameters, the retry fails with an IdempotentParameterMismatch error.

SELECT examples

Retrieves the contents of a managed permission in JSON format.

SELECT
name,
arn,
creation_time,
default_version,
feature_set,
is_resource_type_default,
last_updated_time,
permission,
permission_type,
resource_type,
status,
tags,
version
FROM aws.ram.permissions
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a customer managed permission for a specified resource type that you can attach to resource shares. It is created in the Amazon Web Services Region in which you call the operation.

INSERT INTO aws.ram.permissions (
name,
resourceType,
policyTemplate,
clientToken,
tags,
region
)
SELECT
'{{ name }}' /* required */,
'{{ resourceType }}' /* required */,
'{{ policyTemplate }}' /* required */,
'{{ clientToken }}',
'{{ tags }}',
'{{ region }}'
RETURNING
client_token,
permission
;

DELETE examples

Deletes the specified customer managed permission in the Amazon Web Services Region in which you call this operation. You can delete a customer managed permission only if it isn't attached to any resource share. The operation deletes all versions associated with the customer managed permission.

DELETE FROM aws.ram.permissions
WHERE permissionArn = '{{ permissionArn }}' --required
AND region = '{{ region }}' --required
AND clientToken = '{{ clientToken }}'
;

Lifecycle Methods

When you attach a resource-based policy to a resource, RAM automatically creates a resource share of featureSet=CREATED_FROM_POLICY with a managed permission that has the same IAM permissions as the original resource-based policy. However, this type of managed permission is visible to only the resource share owner, and the associated resource share can't be modified by using RAM. This operation creates a separate, fully manageable customer managed permission that has the same IAM permissions as the original resource-based policy. You can associate this customer managed permission to any resource shares. Before you use PromoteResourceShareCreatedFromPolicy, you should first run this operation to ensure that you have an appropriate customer managed permission that can be associated with the promoted resource share. The original CREATED_FROM_POLICY policy isn't deleted, and resource shares using that original policy aren't automatically updated. You can't modify a CREATED_FROM_POLICY resource share so you can't associate the new customer managed permission by using ReplacePermsissionAssociations. However, if you use PromoteResourceShareCreatedFromPolicy, that operation automatically associates the fully manageable customer managed permission to the newly promoted STANDARD resource share. After you promote a resource share, if the original CREATED_FROM_POLICY managed permission has no other associations to A resource share, then RAM automatically deletes it.

EXEC aws.ram.permissions.promote_permission_created_from_policy
@region='{{ region }}' --required
@@json=
'{
"permissionArn": "{{ permissionArn }}",
"name": "{{ name }}",
"clientToken": "{{ clientToken }}"
}'
;