This documentation is for Version 1 of the Amazon CLI only. For documentation related to Version 2 of the Amazon CLI, see the Version 2 User Guide.
Amazon RAM examples using Amazon CLI
The following code examples show you how to perform actions and implement common scenarios by using the Amazon Command Line Interface with Amazon RAM.
Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.
Each example includes a link to the complete source code, where you can find instructions on how to set up and run the code in context.
Topics
Actions
The following code example shows how to use accept-resource-share-invitation.
- Amazon CLI
-
To accept a resource share invitation
The following
accept-resource-share-invitationexample accepts the specified resource share invitation. Principals in the invited account can immediately start using the resources in the share.aws ram accept-resource-share-invitation \ --resource-share-invitation-arnarn:aws:ram:us-west-2:111111111111:resource-share-invitation/1e3477be-4a95-46b4-bbe0-c4001EXAMPLEOutput:
{ "resourceShareInvitation": { "resourceShareInvitationArn": "arn:aws:ram:us-west-2:111111111111:resource-share-invitation/1e3477be-4a95-46b4-bbe0-c4001EXAMPLE", "resourceShareName": "MyLicenseShare", "resourceShareArn": "arn:aws:ram:us-west-2:111111111111:resource-share/27d09b4b-5e12-41d1-a4f2-19dedEXAMPLE", "senderAccountId": "111111111111", "receiverAccountId": "222222222222", "invitationTimestamp": "2021-09-22T15:07:35.620000-07:00", "status": "ACCEPTED" } }-
For API details, see AcceptResourceShareInvitation
in Amazon CLI Command Reference.
-
The following code example shows how to use associate-resource-share-permission.
- Amazon CLI
-
To associate a RAM managed permission with a resource share
The following
associate-resource-share-permissionexample replaces the existing managed permission for the relevant resource type with the specified managed permission. Access to all resources of the relevant resource type is governed by the new permission.aws ram associate-resource-share-permission \ --permission-arnarn:aws:ram::aws:permission/AWSRAMPermissionGlueDatabaseReadWrite\ --replace \ --resource-share-arnarn:aws:ram:us-west-2:123456789012:resource-share/27d09b4b-5e12-41d1-a4f2-19dedEXAMPLEOutput:
{ "returnValue": true }-
For API details, see AssociateResourceSharePermission
in Amazon CLI Command Reference.
-
The following code example shows how to use associate-resource-share.
- Amazon CLI
-
Example 1: To associate a resource with a resource share
The following
associate-resource-shareexample adds a license configuration to the specified resource share.aws ram associate-resource-share \ --resource-sharearn:aws:ram:us-west-2:123456789012:resource-share/27d09b4b-5e12-41d1-a4f2-19dedEXAMPLE\ --resource-arnsarn:aws:license-manager:us-west-2:123456789012:license-configuration:lic-36be0485f5ae379cc74cf8e92EXAMPLEOutput:
{ "resourceShareAssociations": [ { "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/27d09b4b-5e12-41d1-a4f2-19dedEXAMPLE", "associatedEntity": "arn:aws:license-manager:us-west-2:123456789012:license-configuration:lic-36be0485f5ae379cc74cf8e92EXAMPLE", "associationType": "RESOURCE", "status": "ASSOCIATING", "external": false } ] }Example 2: To associate a principal with a resource share
The following
associate-resource-shareexample grants access for the specified resource share to all accounts in the specified organizational unit.aws ram associate-resource-share \ --resource-share-arnarn:aws:ram:us-west-2:123456789012:resource-share/27d09b4b-5e12-41d1-a4f2-19dedEXAMPLE\ --principalsarn:aws:organizations::123456789012:ou/o-63bEXAMPLE/ou-46xi-rEXAMPLEOutput:
{ "resourceShareAssociations": [ { "status": "ASSOCIATING", "associationType": "PRINCIPAL", "associatedEntity": "arn:aws:organizations::123456789012:ou/o-63bEXAMPLE/ou-46xi-rEXAMPLE", "external": false, "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/27d09b4b-5e12-41d1-a4f2-19dedEXAMPLE" } ] }-
For API details, see AssociateResourceShare
in Amazon CLI Command Reference.
-
The following code example shows how to use create-resource-share.
- Amazon CLI
-
Example 1: To create a resource share
The following
create-resource-shareexample creates an empty resource share with the specified name. You must separately add resources, principals, and permissions to the share.aws ram create-resource-share \ --nameMyNewResourceShareOutput:
{ "resourceShare": { "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/4476c27d-8feb-4b21-afe9-7de23EXAMPLE", "name": "MyNewResourceShare", "owningAccountId": "123456789012", "allowExternalPrincipals": true, "status": "ACTIVE", "creationTime": 1634586271.302, "lastUpdatedTime": 1634586271.302 } }Example 2: To create a resource share with Amazon accounts as principals
The following
create-resource-shareexample creates a resource share and grants access to the specified Amazon account (222222222222). If the specified principals are not part of the same Amazon Organization, then invitations are sent and must be accepted before access is granted.aws ram create-resource-share \ --nameMyNewResourceShare\ --principals222222222222Example 3: To create a resource share restricted to your Amazon Organization
The following
create-resource-shareexample creates a resource share that is restricted to accounts in the Amazon Organization that your account is a member of, and adds the specified OU as a principal. All accounts in that OU can use the resources in the resource share.aws ram create-resource-share \ --nameMyNewResourceShare\ --no-allow-external-principals \ --principalsarn:aws:organizations::123456789012:ou/o-63bEXAMPLE/ou-46xi-rEXAMPLEOutput:
{ "resourceShare": { "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/7be8694e-095c-41ca-9ce8-7be4aEXAMPLE", "name": "MyNewResourceShare", "owningAccountId": "123456789012", "allowExternalPrincipals": false, "status": "ACTIVE", "creationTime": 1634587042.49, "lastUpdatedTime": 1634587042.49 } }-
For API details, see CreateResourceShare
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-resource-share.
- Amazon CLI
-
To delete a resource share
The following
delete-resource-shareexample deletes the specified resource share.aws ram delete-resource-share \ --resource-share-arnarn:aws:ram:us-west-2:123456789012:resource-share/7ab63972-b505-7e2a-420d-6f5d3EXAMPLEThe following output indicates success:
{ "returnValue": true }-
For API details, see DeleteResourceShare
in Amazon CLI Command Reference.
-
The following code example shows how to use disassociate-resource-share-permission.
- Amazon CLI
-
To remove a RAM managed permission for a resource type from a resource share
The following
disassociate-resource-share-permissionexample removes the RAM managed permission for Glue databases from the specified resource share.aws ram disassociate-resource-share-permission \ --resource-share-arnarn:aws:ram:us-west-2:123456789012:resource-share/27d09b4b-5e12-41d1-a4f2-19dedEXAMPLE\ --permission-arnarn:aws:ram::aws:permission/AWSRAMPermissionGlueDatabaseReadWriteOutput:
{ "returnValue": true }-
For API details, see DisassociateResourceSharePermission
in Amazon CLI Command Reference.
-
The following code example shows how to use disassociate-resource-share.
- Amazon CLI
-
To remove a resource from a resource share
The following
disassociate-resource-shareexample removes the specified resource, in this case a VPC subnet, from the specified resource share. Any principals with access to the resource share can no longer perform operations on that resource.aws ram disassociate-resource-share \ --resource-arnsarn:aws:ec2:us-west-2:123456789012:subnet/subnet-0250c25a1fEXAMPLE\ --resource-share-arnarn:aws:ram:us-west-2:123456789012:resource-share/7ab63972-b505-7e2a-420d-6f5d3EXAMPLEOutput:
{ "resourceShareAssociations": [ "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/7ab63972-b505-7e2a-420d-6f5d3EXAMPLE", "associatedEntity": "arn:aws:ec2:us-west-2:123456789012:subnet/subnet-0250c25a1fEXAMPLE", "associationType": "RESOURCE", "status": "DISASSOCIATING", "external": false ] }-
For API details, see DisassociateResourceShare
in Amazon CLI Command Reference.
-
The following code example shows how to use enable-sharing-with-aws-organization.
- Amazon CLI
-
To enable resource sharing across Amazon Organizations
The following
enable-sharing-with-aws-organizationexample enables resource sharing across your organization and organizational units.aws ram enable-sharing-with-aws-organizationThe following output indicates success.
{ "returnValue": true }-
For API details, see EnableSharingWithAwsOrganization
in Amazon CLI Command Reference.
-
The following code example shows how to use get-permission.
- Amazon CLI
-
To retrieve the details for a RAM managed permission
The following
get-permissionexample displays the details for the default version of the specified RAM managed permission.aws ram get-permission \ --permission-arnarn:aws:ram::aws:permission/AWSRAMPermissionGlueTableReadWriteForDatabaseOutput:
{ "permission": { "arn": "arn:aws:ram::aws:permission/AWSRAMPermissionGlueTableReadWriteForDatabase", "version": "2", "defaultVersion": true, "name": "AWSRAMPermissionGlueTableReadWriteForDatabase", "resourceType": "glue:Database", "permission": "{\"Effect\":\"Allow\",\"Action\":[\"glue:GetTable\", \"glue:UpdateTable\", \"glue:DeleteTable\", \"glue:BatchDeleteTable\", \"glue:BatchDeleteTableVersion\", \"glue:GetTableVersion\", \"glue:GetTableVersions\", \"glue:GetPartition\", \"glue:GetPartitions\", \"glue:BatchGetPartition\", \"glue:BatchCreatePartition\", \"glue:CreatePartition\", \"glue:UpdatePartition\", \"glue:BatchDeletePartition\", \"glue:DeletePartition\", \"glue:GetTables\", \"glue:SearchTables\"]}", "creationTime": 1624912434.431, "lastUpdatedTime": 1624912434.431, "isResourceTypeDefault": false } }-
For API details, see GetPermission
in Amazon CLI Command Reference.
-
The following code example shows how to use get-resource-policies.
- Amazon CLI
-
To get the policies for a resource
The following
get-resource-policiesexample displays the resource-based permission policies for the specified resource associated with a resource share.aws ram get-resource-policies \ --resource-arnsarn:aws:ec2:us-west-2:123456789012:subnet/subnet-0250c25a1fEXAMPLEOutput:
{ "policies": [ "{\"Version\":\"2008-10-17\",\"Statement\":[{\"Sid\":\"RamStatement1\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[]},\"Action\":[\"ec2:RunInstances\",\"ec2:CreateNetworkInterface\",\"ec2:DescribeSubnets\"],\"Resource\":\"arn:aws:ec2:us-west-2:123456789012:subnet/subnet-0250c25a1fEXAMPLE\"}]}" ] }-
For API details, see GetResourcePolicies
in Amazon CLI Command Reference.
-
The following code example shows how to use get-resource-share-associations.
- Amazon CLI
-
Example 1: To list all resource associations for all resource types
The following
get-resource-share-associationsexample lists the resource associations for all resource types across all of your resource shares.aws ram get-resource-share-associations \ --association-typeRESOURCEOutput:
{ "resourceShareAssociations": [ { "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/7ab63972-b505-7e2a-420d-6f5d3EXAMPLE", "associatedEntity": "arn:aws:ec2:us-west-2:123456789012:subnet/subnet-0250c25a1fEXAMPLE", "resourceShareName": "MySubnetShare", "associationType": "RESOURCE", "status": "ASSOCIATED", "creationTime": 1565303590.973, "lastUpdatedTime": 1565303591.695, "external": false }, { "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/8167bdfe-4480-4a01-8632-315e0EXAMPLE", "associatedEntity": "arn:aws:license-manager:us-west-2:123456789012:license-configuration:lic-36be0485f5ae379cc74cf8e92EXAMPLE", "resourceShareName": "MyLicenseShare", "associationType": "RESOURCE", "status": "ASSOCIATED", "creationTime": 1632342958.457, "lastUpdatedTime": 1632342958.907, "external": false } ] }Example 2: To list principal associations for a resource share
The following
get-resource-share-associationsexample lists only the principal associations for only the specified resource share.aws ram get-resource-share-associations \ --resource-share-arnsarn:aws:ram:us-west-2:123456789012:resource-share/7be8694e-095c-41ca-9ce8-7be4aEXAMPLE\ --association-typePRINCIPALOutput:
{ "resourceShareAssociations": [ { "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/7be8694e-095c-41ca-9ce8-7be4aEXAMPLE", "resourceShareName": "MyNewResourceShare", "associatedEntity": "arn:aws:organizations::123456789012:ou/o-63bEXAMPLE/ou-46xi-rEXAMPLE", "associationType": "PRINCIPAL", "status": "ASSOCIATED", "creationTime": 1634587042.49, "lastUpdatedTime": 1634587044.291, "external": false } ] }-
For API details, see GetResourceShareAssociations
in Amazon CLI Command Reference.
-
The following code example shows how to use get-resource-share-invitations.
- Amazon CLI
-
To list your resource share invitations
The following
get-resource-share-invitationsexample lists your current resource share invitations.aws ram get-resource-share-invitationsOutput:
{ "resourceShareInvitations": [ { "resourceShareInvitationArn": "arn:aws:ram:us-west2-1:111111111111:resource-share-invitation/32b639f0-14b8-7e8f-55ea-e6117EXAMPLE", "resourceShareName": "project-resource-share", "resourceShareArn": "arn:aws:ram:us-west-2:111111111111:resource-share/fcb639f0-1449-4744-35bc-a983fEXAMPLE", "senderAccountId": "111111111111", "receiverAccountId": "222222222222", "invitationTimestamp": 1565312166.258, "status": "PENDING" } ] }-
For API details, see GetResourceShareInvitations
in Amazon CLI Command Reference.
-
The following code example shows how to use get-resource-shares.
- Amazon CLI
-
Example 1: To list resource shares you own and share with others
The following
get-resource-sharesexample lists the resource shares that created and are sharing with others.aws ram get-resource-shares \ --resource-ownerSELFOutput:
{ "resourceShares": [ { "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/3ab63985-99d9-1cd2-7d24-75e93EXAMPLE", "name": "my-resource-share", "owningAccountId": "123456789012", "allowExternalPrincipals": false, "status": "ACTIVE", "tags": [ { "key": "project", "value": "lima" } ] "creationTime": 1565295733.282, "lastUpdatedTime": 1565295733.282 }, { "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/7ab63972-b505-7e2a-420d-6f5d3EXAMPLE", "name": "my-resource-share", "owningAccountId": "123456789012", "allowExternalPrincipals": true, "status": "ACTIVE", "creationTime": 1565295733.282, "lastUpdatedTime": 1565295733.282 } ] }Example 2: To list resource shares owned by others and shared with you
The following
get-resource-sharesexample lists the resource shares that others created and shared with you. In this example, there are none.aws ram get-resource-shares \ --resource-ownerOTHER-ACCOUNTSOutput:
{ "resourceShares": [] }-
For API details, see GetResourceShares
in Amazon CLI Command Reference.
-
The following code example shows how to use list-pending-invitation-resources.
- Amazon CLI
-
To list the resources that are available in a pending resource share
The following
list-pending-invitation-resourcesexample lists all of the resources that are in the resource share associated with the specified invitation.aws ram list-pending-invitation-resources \ --resource-share-invitation-arnarn:aws:ram:us-west-2:123456789012:resource-share-invitation/1e3477be-4a95-46b4-bbe0-c4001EXAMPLEOutput:
{ "resources": [ { "arn": "arn:aws:ec2:us-west-2:123456789012:subnet/subnet-04a555b0e6EXAMPLE", "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/7be8694e-095c-41ca-9ce8-7be4aEXAMPLE", "creationTime": 1634676051.269, "lastUpdatedTime": 1634676052.07, "status": "AVAILABLE", "type": "ec2:Subnet" }, { "arn": "arn:aws:license-manager:us-west-2:123456789012:license-configuration:lic-36be0485f5ae379cc74cf8e92EXAMPLE", "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/7ab63972-b505-7e2a-420d-6f5d3EXAMPLE", "creationTime": 1624912434.431, "lastUpdatedTime": 1624912434.431, "status": "AVAILABLE", "type": "license-manager:LicenseConfiguration" } ] }-
For API details, see ListPendingInvitationResources
in Amazon CLI Command Reference.
-
The following code example shows how to use list-permissions.
- Amazon CLI
-
To list the available RAM managed permissions
The following
list-permissionsexample lists all of the RAM managed permissions available for only the Amazon Glue database resource type.aws ram list-permissions \ --resource-typeglue:DatabaseOutput:
{ "permissions": [ { "arn": "arn:aws:ram::aws:permission/AWSRAMDefaultPermissionGlueDatabase", "version": "1", "defaultVersion": true, "name": "AWSRAMDefaultPermissionGlueDatabase", "resourceType": "glue:Database", "creationTime": 1592007820.935, "lastUpdatedTime": 1592007820.935, "isResourceTypeDefault": true }, { "arn": "arn:aws:ram::aws:permission/AWSRAMPermissionGlueAllTablesReadWriteForDatabase", "version": "2", "defaultVersion": true, "name": "AWSRAMPermissionGlueAllTablesReadWriteForDatabase", "resourceType": "glue:Database", "creationTime": 1624912413.323, "lastUpdatedTime": 1624912413.323, "isResourceTypeDefault": false }, { "arn": "arn:aws:ram::aws:permission/AWSRAMPermissionGlueDatabaseReadWrite", "version": "2", "defaultVersion": true, "name": "AWSRAMPermissionGlueDatabaseReadWrite", "resourceType": "glue:Database", "creationTime": 1624912417.4, "lastUpdatedTime": 1624912417.4, "isResourceTypeDefault": false }, { "arn": "arn:aws:ram::aws:permission/AWSRAMPermissionGlueTableReadWriteForDatabase", "version": "2", "defaultVersion": true, "name": "AWSRAMPermissionGlueTableReadWriteForDatabase", "resourceType": "glue:Database", "creationTime": 1624912434.431, "lastUpdatedTime": 1624912434.431, "isResourceTypeDefault": false } ] }The following
list-permissionsexample displays the available RAM managed permissions for all resource types.aws ram list-permissionsOutput:
{ "permissions": [ { "arn": "arn:aws:ram::aws:permission/AWSRAMBlankEndEntityCertificateAPICSRPassthroughIssuanceCertificateAuthority", "version": "1", "defaultVersion": true, "name": "AWSRAMBlankEndEntityCertificateAPICSRPassthroughIssuanceCertificateAuthority", "resourceType": "acm-pca:CertificateAuthority", "creationTime": 1623264861.085, "lastUpdatedTime": 1623264861.085, "isResourceTypeDefault": false }, { "arn": "arn:aws:ram::aws:permission/AWSRAMDefaultPermissionAppMesh", "version": "1", "defaultVersion": true, "name": "AWSRAMDefaultPermissionAppMesh", "resourceType": "appmesh:Mesh", "creationTime": 1589307188.584, "lastUpdatedTime": 1589307188.584, "isResourceTypeDefault": true }, ...TRUNCATED FOR BREVITY... { "arn": "arn:aws:ram::aws:permission/AWSRAMSubordinateCACertificatePathLen0IssuanceCertificateAuthority", "version": "1", "defaultVersion": true, "name": "AWSRAMSubordinateCACertificatePathLen0IssuanceCertificateAuthority", "resourceType": "acm-pca:CertificateAuthority", "creationTime": 1623264876.75, "lastUpdatedTime": 1623264876.75, "isResourceTypeDefault": false } ] }-
For API details, see ListPermissions
in Amazon CLI Command Reference.
-
The following code example shows how to use list-principals.
- Amazon CLI
-
To list principals with access to a resource
The following
list-principalsexample displays a list of the principals that can access resources of the specified type through any resource shares.aws ram list-principals \ --resource-typeec2:SubnetOutput:
{ "principals": [ { "id": "arn:aws:organizations::123456789012:ou/o-gx7EXAMPLE/ou-29c5-zEXAMPLE", "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/7ab63972-b505-7e2a-420d-6f5d3EXAMPLE", "creationTime": 1565298209.737, "lastUpdatedTime": 1565298211.019, "external": false } ] }-
For API details, see ListPrincipals
in Amazon CLI Command Reference.
-
The following code example shows how to use list-resource-share-permissions.
- Amazon CLI
-
To list all of the RAM managed permissions currently attached to a resource share
The following
list-resource-share-permissionsexample lists all of the RAM managed permissions that are attached to the specified resource share.aws ram list-resource-share-permissions \ --resource-share-arnarn:aws:ram:us-west-2:123456789012:resource-share/27d09b4b-5e12-41d1-a4f2-19dedEXAMPLEOutput:
{ "permissions": [ { "arn": "arn:aws:ram::aws:permission/AWSRAMDefaultPermissionLicenseConfiguration", "version": "1", "resourceType": "license-manager:LicenseConfiguration", "status": "ASSOCIATED", "lastUpdatedTime": 1632342984.234 }, { "arn": "arn:aws:ram::aws:permission/AWSRAMPermissionGlueDatabaseReadWrite", "version": "2", "resourceType": "glue:Database", "status": "ASSOCIATED", "lastUpdatedTime": 1632512462.297 } ] }-
For API details, see ListResourceSharePermissions
in Amazon CLI Command Reference.
-
The following code example shows how to use list-resource-types.
- Amazon CLI
-
To list the resource types that are supported by Amazon RAM
The following
list-resource-typesexample lists all of the resource types currently supported by Amazon RAM.aws ram list-resource-typesOutput:
{ "resourceTypes": [ { "resourceType": "route53resolver:FirewallRuleGroup", "serviceName": "route53resolver" }, { "resourceType": "ec2:LocalGatewayRouteTable", "serviceName": "ec2" }, ...OUTPUT TRUNCATED FOR BREVITY... { "resourceType": "ec2:Subnet", "serviceName": "ec2" }, { "resourceType": "ec2:TransitGatewayMulticastDomain", "serviceName": "ec2" } ] }-
For API details, see ListResourceTypes
in Amazon CLI Command Reference.
-
The following code example shows how to use list-resources.
- Amazon CLI
-
To list the resources associated with a resource share
The following
list-resourcesexample lists all resources in the specified resource share that are of the specified resource type.aws ram list-resources \ --resource-typeec2:Subnet\ --resource-ownerSELF\ --resource-share-arnarn:aws:ram:us-west-2:123456789012:resource-share/7ab63972-b505-7e2a-420d-6f5d3EXAMPLEOutput:
{ "resources": [ { "arn": "aarn:aws:ec2:us-west-2:123456789012:subnet/subnet-0250c25a1f4e15235", "type": "ec2:Subnet", "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/7ab63972-b505-7e2a-420d-6f5d3EXAMPLE", "creationTime": 1565301545.023, "lastUpdatedTime": 1565301545.947 } ] }-
For API details, see ListResources
in Amazon CLI Command Reference.
-
The following code example shows how to use promote-resource-share-created-from-policy.
- Amazon CLI
-
To promote a resource-policy based resource share to full functionality in Amazon RAM
The following
promote-resource-share-created-from-policyexample takes a resource share that you created implicitly by attaching a resource-based policy, and converts it to be fully functional with the Amazon RAM console and its CLI and API operations.aws ram promote-resource-share-created-from-policy \ --resource-share-arnarn:aws:ram:us-east-1:123456789012:resource-share/91fa8429-2d06-4032-909a-90909EXAMPLEOutput:
{ "returnValue": true }-
For API details, see PromoteResourceShareCreatedFromPolicy
in Amazon CLI Command Reference.
-
The following code example shows how to use reject-resource-share-invitation.
- Amazon CLI
-
To reject a resource share invitation
The following
reject-resource-share-invitationexample rejects the specified resource share invitation.aws ram reject-resource-share-invitation \ --resource-share-invitation-arnarn:aws:ram:us-west-2:111111111111:resource-share-invitation/32b639f0-14b8-7e8f-55ea-e6117EXAMPLEOutput:
"resourceShareInvitations": [ { "resourceShareInvitationArn": "arn:aws:ram:us-west2-1:111111111111:resource-share-invitation/32b639f0-14b8-7e8f-55ea-e6117EXAMPLE", "resourceShareName": "project-resource-share", "resourceShareArn": "arn:aws:ram:us-west-2:111111111111:resource-share/fcb639f0-1449-4744-35bc-a983fEXAMPLE", "senderAccountId": "111111111111", "receiverAccountId": "222222222222", "invitationTimestamp": 1565319592.463, "status": "REJECTED" } ]-
For API details, see RejectResourceShareInvitation
in Amazon CLI Command Reference.
-
The following code example shows how to use tag-resource.
- Amazon CLI
-
To add tags to a resource share
The following
tag-resourceexample adds a tag keyprojectand associated valuelimato the specified resource share.aws ram tag-resource \ --tagskey=project,value=lima\ --resource-share-arnarn:aws:ram:us-west-2:123456789012:resource-share/7ab63972-b505-7e2a-420d-6f5d3EXAMPLEThis command produces no output.
-
For API details, see TagResource
in Amazon CLI Command Reference.
-
The following code example shows how to use untag-resource.
- Amazon CLI
-
To remove tags from a resource share
The following
untag-resourceexample removes theprojecttag key and associated value from the specified resource share.aws ram untag-resource \ --tag-keysproject\ --resource-share-arnarn:aws:ram:us-west-2:123456789012:resource-share/7ab63972-b505-7e2a-420d-6f5d3EXAMPLEThis command produces no output.
-
For API details, see UntagResource
in Amazon CLI Command Reference.
-
The following code example shows how to use update-resource-share.
- Amazon CLI
-
To update a resource share
The following
update-resource-shareexample changes the specified resource share to allow external principals that are not in an Amazon Organization.aws ram update-resource-share \ --allow-external-principals \ --resource-share-arnarn:aws:ram:us-west-2:123456789012:resource-share/7ab63972-b505-7e2a-420d-6f5d3EXAMPLEOutput:
{ "resourceShare": { "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/7ab63972-b505-7e2a-420d-6f5d3EXAMPLE", "name": "my-resource-share", "owningAccountId": "123456789012", "allowExternalPrincipals": true, "status": "ACTIVE", "creationTime": 1565295733.282, "lastUpdatedTime": 1565303080.023 } }-
For API details, see UpdateResourceShare
in Amazon CLI Command Reference.
-