

# Using service-linked roles for AWS Marketplace
<a name="buyer-using-service-linked-roles"></a>

AWS Marketplace uses AWS Identity and Access Management (IAM)[ service-linked roles](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-linked-role). A service-linked role is a unique type of IAM role that is linked directly to AWS Marketplace. Service-linked roles are predefined by AWS Marketplace and include all the permissions that the service requires to call other AWS services on your behalf.

A service-linked role makes setting up AWS Marketplace easier because you don't have to add the necessary permissions manually. AWS Marketplace defines the permissions of its service-linked roles, and unless defined otherwise, only AWS Marketplace can assume its roles. The defined permissions include the trust policy and the permissions policy. That permissions policy can't be attached to any other IAM entity.

For information about other services that support service-linked roles, see [AWS services that work with IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html), and look for the services with **Yes ** in the **Service-linked roles** column. Choose a **Yes ** with a link to view the service-linked role documentation for that service.

# Creating a service-linked role for AWS Marketplace
<a name="buyer-creating-service-linked-role"></a>

AWS Marketplace creates the service-linked role for you when you set up integration with AWS License Manager.

 You can specify that AWS Marketplace create the service-linked role for all accounts in your organization at once, or you can create the service-linked role for one account at a time. The option to create service-linked roles across all accounts is only available if your organization has **All features** enabled. For more details, see [ Enabling all features in your organization](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_support-all-features.html) in the *AWS Organizations User Guide*.

**To create service-linked roles across all accounts**

1. In [AWS Marketplace console](https://console.aws.amazon.com/marketplace/), sign in and choose **Settings**.

1. In the **AWS Marketplace procurement insights integration** section, select **View setting details**.

1. On the **Create AWS Marketplace procurement insights integration** page, select **Enable trusted access across your organization**, then choose **Create integration**.
**Note**  
This setting enables trust within AWS Organizations. As a result, in addition to the current action, future accounts that are added to the organization have the service-linked role added automatically.

**To create service-linked roles for the current account**

1. In [AWS Marketplace console](https://console.aws.amazon.com/marketplace/), sign in and choose **Settings**.

1. In the **AWS License Manager integration** section, select **View setting details**.

1. On the **Create AWS License Manager integration** page, under **Enable AWS Marketplace to manage licenses for your AWS Organizations accounts**, select **AWS Marketplace license management service-linked role for this account**, then choose **Create integration**.

**Important**  
If you create the service-linked role only for the current account, you do not enable trusted access across your organization, and you must repeat these steps for each account that wants to share (giving or receiving) licenses in AWS Marketplace. This includes all future accounts.

# Editing a service-linked role for AWS Marketplace
<a name="buyer-editing-service-linked-role"></a>

AWS Marketplace doesn't allow you to edit the service-linked role. After you create a service-linked role, you cannot change the name of the role because various entities might reference the role. However, you can edit the description of the role using IAM. For more information, see [Editing a service-linked role](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#edit-service-linked-role) in the *IAM User Guide*.

# Deleting a service-linked role for AWS Marketplace
<a name="buyer-delete-service-linked-role"></a>

If you no longer need to use a feature or service that requires a service-linked role, we recommend that you delete that role. That way you don’t have an unused entity that is not actively monitored or maintained. However, you must clean up the resources for your service-linked role before you can manually delete it.

**Note**  
If the AWS Marketplace service is using the role when you try to delete the resources, then the deletion might fail. If that happens, wait for a few minutes and try the operation again.

**To manually delete the service-linked role using IAM**

Use the IAM console, the AWS CLI, or the AWS API to delete the `AWSServiceRoleForMarketplaceLicenseManagement` service-linked role. For more information, see [Deleting a Service-Linked Role](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#delete-service-linked-role) in the *IAM User Guide *.

## Supported Regions for AWS Marketplace service-linked roles
<a name="buyer-slr-regions"></a>

AWS Marketplace supports using service-linked roles in all of the AWS Regions where the service is available. For more information, see [AWS Marketplace Regions and Endpoints](https://docs.aws.amazon.com/general/latest/gr/aws-marketplace.html#aws-marketplace_region).

# Service-linked role to share entitlements for AWS Marketplace
<a name="buyer-using-service-linked-roles-license-manager"></a>

To share your AWS Marketplace subscriptions to other accounts in your AWS organization with AWS License Manager, you must give AWS Marketplace permissions for each account you want to share with. Do this by using the **AWSServiceRoleForMarketplaceLicenseManagement** role. This role provides AWS Marketplace with permissions to create and manage licenses in AWS License Manager for the products that you subscribe to in AWS Marketplace.

The `AWSServiceRoleForMarketplaceLicenseManagement` service-linked role trusts the following service to perform actions in License Manager on your behalf:
+ `license-management.marketplace.amazonaws.com`

The `AWSMarketplaceLicenseManagementServiceRolePolicy` allows AWS Marketplace to complete the following actions on the specified resources:
+ Actions: 
  + `"organizations:DescribeOrganization"`
  + `"license-manager:ListReceivedGrants"`
  + `"license-manager:ListDistributedGrants"`
  + `"license-manager:GetGrant"`
  + `"license-manager:CreateGrant"`
  + `"license-manager:CreateGrantVersion"`
  + `"license-manager:DeleteGrant"`
  + `"license-manager:AcceptGrant"`
+ Resources:
  + All resources (`"*"`)

You must configure permissions to allow an IAM entity (such as a user, group, or role) to create, edit, or delete a service-linked role. For more information, see [ Service-linked role permissions](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#service-linked-role-permissions) in the *IAM User Guide*. 

# Service-linked role to configure and launch products in AWS Marketplace
<a name="using-service-linked-roles-secrets"></a>

AWS Marketplace uses the service-linked role named `AWSServiceRoleForMarketplaceDeployment` to allow AWS Marketplace to manage deployment-related parameters, which are stored as secrets in [AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html), on your behalf. These secrets can be referenced by sellers in CloudFormation templates, which you can launch when configuring products that have Quick Launch enabled in AWS Marketplace.

The `AWSServiceRoleForMarketplaceDeployment` service-linked role trusts the following services to assume the role:
+ `deployment.marketplace.amazonaws.com`

The `AWSMarketplaceDeploymentServiceRolePolicy` allows AWS Marketplace to complete the following actions on your resources.

**Note**  
For more information about AWS Marketplace managed policies, see [AWS managed policies for AWS Marketplace buyers](buyer-security-iam-awsmanpol.md).

------
#### [ JSON ]

****  

```
{
	"Version":"2012-10-17",		 	 	 
	"Statement": [
		{
			"Sid": "ManageMarketplaceDeploymentSecrets",
			"Effect": "Allow",
			"Action": [
				"secretsmanager:CreateSecret",
				"secretsmanager:PutSecretValue",
				"secretsmanager:DescribeSecret",
				"secretsmanager:DeleteSecret",
				"secretsmanager:RemoveRegionsFromReplication"
			],
			"Resource": [
				"arn:aws:secretsmanager:*:*:secret:marketplace-deployment*!*"
			],
			"Condition": {
				"StringEquals": {
					"aws:ResourceAccount": "${aws:PrincipalAccount}"
				}
			}
		},
		{
			"Sid": "ListSecrets",
			"Effect": "Allow",
			"Action": [
				"secretsmanager:ListSecrets"
			],
			"Resource": [
				"*"
			]
		},
		{
			"Sid": "TagMarketplaceDeploymentSecrets",
			"Effect": "Allow",
			"Action": [
				"secretsmanager:TagResource"
			],
			"Resource": "arn:aws:secretsmanager:*:*:secret:marketplace-deployment!*",
			"Condition": {
				"Null": {
					"aws:RequestTag/expirationDate": "false"
				},
				"ForAllValues:StringEquals": {
					"aws:TagKeys": [
						"expirationDate"
					]
				},
				"StringEquals": {
					"aws:ResourceAccount": "${aws:PrincipalAccount}"
				}
			}
		}
	]
}
```

------

You must configure permissions to allow your users, groups, or roles to create, edit, or delete a service-linked role. For more information, see [Service-linked role permissions](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#service-linked-role-permissions) in the *IAM User Guide*.

# Service-linked role to configure Private Marketplace in AWS Marketplace
<a name="using-service-linked-roles-private-marketplace"></a>

AWS Marketplace uses the service-linked role named `AWSServiceRoleForPrivateMarketplaceAdmin` to describe and update Private Marketplace resources and describe AWS Organizations.

The `AWSServiceRoleForPrivateMarketplaceAdmin` service-linked role trusts the following services to assume the role:
+ `private-marketplace.marketplace.amazonaws.com`

The `AWSServiceRoleForPrivateMarketplaceAdminPolicy` policy allows AWS Marketplace to perform the following actions on specified resources.

**Note**  
For more information about AWS Marketplace managed policies, see [AWS managed policies for AWS Marketplace buyers](buyer-security-iam-awsmanpol.md) in this guide.

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "PrivateMarketplaceCatalogDescribePermissions",
            "Effect": "Allow",
            "Action": [
                "aws-marketplace:DescribeEntity"
            ],
            "Resource": [
                "arn:aws:aws-marketplace:*:*:AWSMarketplace/Experience/*",
                "arn:aws:aws-marketplace:*:*:AWSMarketplace/Audience/*",
                "arn:aws:aws-marketplace:*:*:AWSMarketplace/ProcurementPolicy/*",
                "arn:aws:aws-marketplace:*:*:AWSMarketplace/BrandingSettings/*"
            ]
        },
        {
            "Sid": "PrivateMarketplaceCatalogDescribeChangeSetPermissions",
            "Effect": "Allow",
            "Action": [
                "aws-marketplace:DescribeChangeSet"
            ],
            "Resource": "*"
        },
        {
            "Sid": "PrivateMarketplaceCatalogListPermissions",
            "Effect": "Allow",
            "Action": [
                "aws-marketplace:ListEntities",
                "aws-marketplace:ListChangeSets"
            ],
            "Resource": "*"
        },
        {
            "Sid": "PrivateMarketplaceStartChangeSetPermissions",
            "Effect": "Allow",
            "Action": [
                "aws-marketplace:StartChangeSet"
            ],
            "Condition": {
                "StringEquals": {
                    "catalog:ChangeType": [
                        "AssociateAudience",
                        "DisassociateAudience"
                    ]
                }
            },
            "Resource": [
                "arn:aws:aws-marketplace:*:*:AWSMarketplace/Experience/*",
                "arn:aws:aws-marketplace:*:*:AWSMarketplace/ChangeSet/*"
            ]
        },
        {
            "Sid": "PrivateMarketplaceOrganizationPermissions",
            "Effect": "Allow",
            "Action": [
                "organizations:DescribeAccount",
                "organizations:DescribeOrganizationalUnit",
                "organizations:ListDelegatedAdministrators",
                "organizations:ListChildren"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}
```

------

You must configure permissions to allow your users, groups, or roles to create, edit, or delete a service-linked role. For more information, see [Service-linked role permissions](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#service-linked-role-permissions) in the *IAM User Guide*.

# Service-linked role to share procurement data
<a name="buyer-service-linked-role-procurement"></a>

AWS Marketplace uses the `AWSServiceRoleForProcurementInsightsPolicy` service-linked role to access and describe the data in your AWS organization. You must create this role in order to use the [Procurement insights dashboard](procurement-insights.md).

The `AWSServiceRoleForProcurementInsightsPolicy` service-linked role trusts the following services to assume the role:
+ `procurement-insights.marketplace.amazonaws.com`

The `AWSServiceRoleForProcurementInsightsPolicy` allows AWS Marketplace to perform the following actions on specified resources.

**Note**  
For more information about AWS Marketplace managed policies, see [AWS managed policies for AWS Marketplace buyers](buyer-security-iam-awsmanpol.md).

------
#### [ JSON ]

****  

```
{
	"Version":"2012-10-17",		 	 	 
	"Statement": [
		{
			"Sid": "ProcurementInsightsPermissions",
			"Effect": "Allow",
			"Action": [
				"organizations:DescribeAccount",
				"organizations:DescribeOrganization",
				"organizations:ListAccounts"
			],
			"Resource": [
				"*"
			]
		}
	]
}
```

------

You must configure permissions to allow your users, groups, or roles to create, edit, or delete a service-linked role. For more information, see [Service-linked role permissions](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#service-linked-role-permissions) in the *IAM User Guide*.