Overview of Managing Access Permissions to Your Amazon Cloud Map Resources - Amazon Cloud Map
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Overview of Managing Access Permissions to Your Amazon Cloud Map Resources

Every Amazon resource is owned by an Amazon account, and permissions to create or access a resource are governed by permissions policies.

Note

An account administrator (or administrator user) is a user that has administrator privileges. For more information about administrators, see IAM Best Practices in the IAM User Guide.

When you grant permissions, you decide who gets the permissions, the resources they get permissions for, and the actions that they get permissions to perform.

ARNs for Amazon Cloud Map Resources

You can grant or deny resource-level permissions for namespaces and services for selected operations. For more information, see Amazon Cloud Map API Permissions: Actions, Resources, and Conditions Reference.

Understanding Resource Ownership

An Amazon account owns the resources that are created in the account, regardless of who created the resources. Specifically, the resource owner is the Amazon account of the principal entity (that is, the root user account, an IAM user, or an IAM role) that authenticates the resource creation request.

The following examples illustrate how this works:

  • If you use the root user account credentials of your Amazon account to create an HTTP namespace, your Amazon account is the owner of the resource.

  • If you create an IAM user in your Amazon account and grant permissions to create an HTTP namespace to that user, the user can create an HTTP namespace. However, your Amazon account, to which the user belongs, owns the HTTP namespace resource.

  • If you create an IAM role in your Amazon account with permissions to create an HTTP namespace, anyone who can assume the role can create an HTTP namespace. Your Amazon account, to which the role belongs, owns the HTTP namespace resource.

Managing Access to Resources

A permissions policy specifies who has access to what. This section explains the options for creating permissions policies for Amazon Cloud Map. For general information about IAM policy syntax and descriptions, see the IAM Policy Reference in the IAM User Guide.

Policies attached to an IAM identity are referred to as identity-based policies (IAM policies), and policies attached to a resource are referred to as resource-based policies. Amazon Cloud Map supports only identity-based policies (IAM policies).

Identity-Based Policies (IAM Policies)

You can attach policies to IAM identities. For example, you can do the following:

  • Attach a permissions policy to a user or a group in your account – An account administrator can use a permissions policy that's associated with a particular user to grant permissions for that user to create Amazon Cloud Map resources.

  • Attach a permissions policy to a role (grant cross-account permissions) – You can grant permission to perform Amazon Cloud Map actions to a user that was created by another Amazon account. To do so, you attach a permissions policy to an IAM role, and then you allow the user in the other account to assume the role. The following example explains how this works for two Amazon accounts, account A and account B:

    1. Account A administrator creates an IAM role and attaches to the role a permissions policy that grants permissions to create or access resources that are owned by account A.

    2. Account A administrator attaches a trust policy to the role. The trust policy identifies account B as the principal that can assume the role.

    3. Account B administrator can then delegate permissions to assume the role to users or groups in Account B. This allows users in account B to create or access resources in account A.

    For more information about how to delegate permissions to users in another Amazon account, see Access Management in the IAM User Guide.

The following example policy allows a user to perform the CreatePublicDnsNamespace action to create a public DNS namespace for any Amazon account. The Amazon Route 53 permissions are required because when you create a public DNS namespace, Amazon Cloud Map also creates a Route 53 hosted zone:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "servicediscovery:CreatePublicDnsNamespace", "route53:CreateHostedZone", "route53:GetHostedZone", "route53:ListHostedZonesByName" ], "Resource":"*" } ] }

If you want the policy to instead apply to private DNS namespaces, you need to grant permissions to use the Amazon Cloud Map CreatePrivateDnsNamespace action. In addition, you grant permission to use the same Route 53 actions as in the previous example because Amazon Cloud Map creates a Route 53 private hosted zone. You also grant permission to use two Amazon EC2 actions, DescribeVpcs and DescribeRegions:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "servicediscovery:CreatePrivateDnsNamespace", "route53:CreateHostedZone", "route53:GetHostedZone", "route53:ListHostedZonesByName" ], "Resource":"*" }, { "Effect": "Allow", "Action": [ "ec2:DescribeVpcs", "ec2:DescribeRegions" ], "Resource":"*" } ] }

For more information about attaching policies to identities for Amazon Cloud Map, see Using Identity-Based Policies (IAM Policies) for Amazon Cloud Map. For more information about users, groups, roles, and permissions, see Identities (Users, Groups, and Roles) in the IAM User Guide.

Resource-Based Policies

Other services, such as Amazon S3, also support attaching permissions policies to resources. For example, you can attach a policy to an S3 bucket to manage access permissions to that bucket. Amazon Cloud Map doesn't support attaching policies to resources.

Specifying Policy Elements: Resources, Actions, Effects, and Principals

Amazon Cloud Map includes API actions (see the Amazon Cloud Map API Reference) that you can use on each Amazon Cloud Map resource (see ARNs for Amazon Cloud Map Resources). You can grant a user or a federated user permissions to perform any or all of these actions. Note that some API actions, such as creating a public DNS namespace, require permissions to perform more than one action.

The following are the basic policy elements:

  • Resource – You use an Amazon Resource Name (ARN) to identify the resource that the policy applies to. For more information, see ARNs for Amazon Cloud Map Resources.

  • Action – You use action keywords to identify resource actions that you want to allow or deny. For example, depending on the specified Effect, the servicediscovery:CreateHttpNamespace permission allows or denies a user the ability to perform the Amazon Cloud Map CreateHttpNamespace action.

  • Effect – You specify the effect, either allow or deny, when a user tries to perform the action on the specified resource. If you don't explicitly grant access to an action, access is implicitly denied. You can also explicitly deny access to a resource, which you might do to make sure that a user can't access it, even if a different policy grants access.

  • Principal – In identity-based policies (IAM policies), the user that the policy is attached to is the implicit principal. For resource-based policies, you specify the user, account, service, or other entity that you want to receive permissions (applies to resource-based policies only). Amazon Cloud Map doesn't support resource-based policies.

For more information about IAM policy syntax and descriptions, see the IAM Policy Reference in the IAM User Guide.

For a list of the Amazon Cloud Map API actions and the resources that they apply to, see Amazon Cloud Map API Permissions: Actions, Resources, and Conditions Reference.

Specifying Conditions in an IAM Policy

When you grant permissions, you can use the IAM policy language to specify when a policy should take effect. For example, you might want a policy to be applied only after a specified date, or you might want a policy to apply only to a specified namespace.

To express conditions, you use predefined condition keys. Amazon Cloud Map defines its own set of condition keys and also supports using some global condition keys. For more information, see the following topics: