CmdID

CmdID / aws / aws ram

aws ram get-resource-share-associations

Retrieves the lists of resources and principals that associated for resource shares that you own. AWS CLI reference

2 examples 7 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

Example 1: To list all resource associations for all resource types

The following get-resource-share-associations example lists the resource associations for all resource types across all of your resource shares.

aws ram get-resource-share-associations --association-type RESOURCEIdentify
--association-typeSpecifies whether you want to retrieve the associations that involve a specified resource or principal.
Its output
{
    "resourceShareAssociations": [
        {
            "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
            "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/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222",
            "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
        }
    ]
}

For more information, see Viewing resource shares you created in AWS RAM in the AWS RAM User Guide.

Example 2: To list principal associations for a resource share

The following get-resource-share-associations example lists only the principal associations for only the specified resource share.

aws ram get-resource-share-associations --resource-share-arns arn:aws:ram:us-west-2:123456789012:resource-share/a1b2c3d4-5678-90ab-cdef-EXAMPLE33333 --association-type PRINCIPALIdentify
--resource-share-arnsSpecifies a list of Amazon Resource Names (ARNs) of the resource share whose associations you want to retrieve.
--association-typeSpecifies whether you want to retrieve the associations that involve a specified resource or principal.
Its output
{
    "resourceShareAssociations": [
        {
            "resourceShareArn": "arn:aws:ram:us-west-2:123456789012:resource-share/a1b2c3d4-5678-90ab-cdef-EXAMPLE33333",
            "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 more information, see Viewing resource shares you created in AWS RAM in the AWS RAM User Guide.

Options

7 in the AWS CLI reference
--association-statusSpecifies that you want to retrieve only associations that have this status.
--association-typeSpecifies whether you want to retrieve the associations that involve a specified resource or principal.
--max-resultsSpecifies the total number of results that you want included on each page of the response.
--next-tokenSpecifies that you want to receive the next page of results.
--principalSpecifies the ID of the principal whose resource shares you want to retrieve.
--resource-arnSpecifies the Amazon Resource Name (ARN) of a resource whose resource shares you want to retrieve.
--resource-share-arnsSpecifies a list of Amazon Resource Names (ARNs) of the resource share whose associations you want to retrieve.