Skip to main content

resource_shares

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

Overview

Nameresource_shares
TypeResource
Idaws.ram.resource_shares

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the resource share.
allow_external_principalsbooleanIndicates whether principals outside your organization in Organizations can be associated with a resource share. True – the resource share can be shared with any Amazon Web Services account. False – the resource share can be shared with only accounts in the same organization as the account that owns the resource share.
creation_timestring (date-time)The date and time when the resource share was created.
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)
last_updated_timestring (date-time)The date and time when the resource share was last updated.
owning_account_idstringThe ID of the Amazon Web Services account that owns the resource share.
resource_share_arnstringThe Amazon Resource Name (ARN) of the resource share
resource_share_configurationobjectThe configuration of the resource share
statusstringThe current status of the resource share. (PENDING, ACTIVE, FAILED, DELETING, DELETED)
status_messagestringA message about the status of the resource share.
tagsarrayThe tag key and value pairs attached to the resource share.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_resource_sharesselectregionRetrieves details about the resource shares that you own or that are shared with you. 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_resource_shareinsertregion, nameCreates a resource share. You can provide a list of the Amazon Resource Names (ARNs) for the resources that you want to share, a list of principals you want to share the resources with, the permissions to grant those principals, and optionally source constraints to enhance security for service principal sharing. Sharing a resource makes it available for use by principals outside of the Amazon Web Services account that created the resource. Sharing doesn't change any permissions or quotas that apply to the resource in the account that created it.
associate_resource_shareupdateregion, resourceShareArnAdds the specified list of principals, resources, and source constraints to a resource share. Principals that already have access to this resource share immediately receive access to the added resources. Newly added principals immediately receive access to the resources shared in this resource share.
delete_resource_sharedeleteresourceShareArn, regionclientTokenDeletes the specified resource share. This doesn't delete any of the resources that were associated with the resource share; it only stops the sharing of those resources through this resource share.
accept_resource_share_invitationexecregion, resourceShareInvitationArnAccepts an invitation to a resource share from another Amazon Web Services account. After you accept the invitation, the resources included in the resource share are available to interact with in the relevant Amazon Web Services Management Consoles and tools.
disassociate_resource_shareexecregion, resourceShareArnRemoves the specified principals, resources, or source constraints from participating in the specified resource share.
promote_resource_share_created_from_policyexecresourceShareArn, regionWhen 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 promotes the resource share to a STANDARD resource share that is fully manageable in RAM. When you promote a resource share, you can then manage the resource share in RAM and it becomes visible to all of the principals you shared it with. Before you perform this operation, you should first run PromotePermissionCreatedFromPolicyto ensure that you have an appropriate customer managed permission that can be associated with this resource share after its is promoted. If this operation can't find a managed permission that exactly matches the existing CREATED_FROM_POLICY permission, then this operation fails.
reject_resource_share_invitationexecregion, resourceShareInvitationArnRejects an invitation to a resource share from another Amazon Web Services account.
update_resource_shareexecregion, resourceShareArnModifies some of the properties of the specified resource share.

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)
resourceShareArnstringSpecifies the Amazon Resource Name (ARN) of the resource share to promote.
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 details about the resource shares that you own or that are shared with you. 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.

SELECT
name,
allow_external_principals,
creation_time,
feature_set,
last_updated_time,
owning_account_id,
resource_share_arn,
resource_share_configuration,
status,
status_message,
tags
FROM aws.ram.resource_shares
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a resource share. You can provide a list of the Amazon Resource Names (ARNs) for the resources that you want to share, a list of principals you want to share the resources with, the permissions to grant those principals, and optionally source constraints to enhance security for service principal sharing. Sharing a resource makes it available for use by principals outside of the Amazon Web Services account that created the resource. Sharing doesn't change any permissions or quotas that apply to the resource in the account that created it.

INSERT INTO aws.ram.resource_shares (
name,
resourceArns,
principals,
tags,
allowExternalPrincipals,
clientToken,
permissionArns,
sources,
resourceShareConfiguration,
region
)
SELECT
'{{ name }}' /* required */,
'{{ resourceArns }}',
'{{ principals }}',
'{{ tags }}',
{{ allowExternalPrincipals }},
'{{ clientToken }}',
'{{ permissionArns }}',
'{{ sources }}',
'{{ resourceShareConfiguration }}',
'{{ region }}'
RETURNING
client_token,
resource_share
;

UPDATE examples

Adds the specified list of principals, resources, and source constraints to a resource share. Principals that already have access to this resource share immediately receive access to the added resources. Newly added principals immediately receive access to the resources shared in this resource share.

UPDATE aws.ram.resource_shares
SET
resourceShareArn = '{{ resourceShareArn }}',
resourceArns = '{{ resourceArns }}',
principals = '{{ principals }}',
clientToken = '{{ clientToken }}',
sources = '{{ sources }}'
WHERE
region = '{{ region }}' --required
AND resourceShareArn = '{{ resourceShareArn }}' --required
RETURNING
client_token,
resource_share_associations;

DELETE examples

Deletes the specified resource share. This doesn't delete any of the resources that were associated with the resource share; it only stops the sharing of those resources through this resource share.

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

Lifecycle Methods

Accepts an invitation to a resource share from another Amazon Web Services account. After you accept the invitation, the resources included in the resource share are available to interact with in the relevant Amazon Web Services Management Consoles and tools.

EXEC aws.ram.resource_shares.accept_resource_share_invitation
@region='{{ region }}' --required
@@json=
'{
"resourceShareInvitationArn": "{{ resourceShareInvitationArn }}",
"clientToken": "{{ clientToken }}"
}'
;