What are the two types of AWS Identity and Access Management IAM policies?

A policy is an object in AWS that, when associated with an identity or resource, defines their permissions. When you create a permissions policy to restrict access to a resource, you can choose an identity-based policy or a resource-based policy.

Identity-based policies are attached to an IAM user, group, or role. These policies let you specify what that identity can do (its permissions). For example, you can attach the policy to the IAM user named John, stating that he is allowed to perform the Amazon EC2 RunInstances action. The policy could further state that John is allowed to get items from an Amazon DynamoDB table named MyCompany. You can also allow John to manage his own IAM security credentials. Identity-based policies can be managed or inline.

Resource-based policies are attached to a resource. For example, you can attach resource-based policies to Amazon S3 buckets, Amazon SQS queues, VPC endpoints, and AWS Key Management Service encryption keys. For a list of services that support resource-based policies, see AWS services that work with IAM.

With resource-based policies, you can specify who has access to the resource and what actions they can perform on it. To learn whether principals in accounts outside of your zone of trust (trusted organization or account) have access to assume your roles, see What is IAM Access Analyzer?. Resource-based policies are inline only, not managed.

Resource-based policies differ from resource-level permissions. You can attach resource-based policies directly to a resource, as described in this topic. Resource-level permissions refer to the ability to use to specify individual resources in a policy. Resource-based policies are supported only by some AWS services. For a list of which services support resource-based policies and resource-level permissions, see AWS services that work with IAM.

To learn how identity-based policies and resource-based policies interact within the same account, see .

To learn how the policies interact across accounts, see Cross-account policy evaluation logic.

To better understand these concepts, view the following figure. The administrator of the 123456789012 account attached identity-based policies to the JohnSmith, CarlosSalazar, and MaryMajor users. Some of the actions in these policies can be performed on specific resources. For example, the user JohnSmith can perform some actions on Resource X. This is a resource-level permission in an identity-based policy. The administrator also added resource-based policies to Resource X, Resource Y, and MyCompany0. Resource-based policies allow you to specify who can access that resource. For example, the resource-based policy on Resource X allows the JohnSmith and MaryMajor users list and read access to the resource.

What are the two types of AWS Identity and Access Management IAM policies?

The 123456789012 account example allows the following users to perform the listed actions:

  • JohnSmith – John can perform list and read actions on Resource X. He is granted this permission by the identity-based policy on his user and the resource-based policy on Resource X.

  • CarlosSalazar – Carlos can perform list, read, and write actions on Resource Y, but is denied access to MyCompany0. The identity-based policy on Carlos allows him to perform list and read actions on Resource Y. The Resource Y resource-based policy also allows him write permissions. However, although his identity-based policy allows him access to MyCompany0, the MyCompany0 resource-based policy denies that access. An explicit 1234567890123 overrides an 1234567890124 and his access to MyCompany0 is denied. For more information, see Policy evaluation logic.

  • MaryMajor – Mary can perform list, read, and write operations on Resource X, Resource Y, and MyCompany0. Her identity-based policy allows her more actions on more resources than the resource-based policies, but none of them deny access.

  • ZhangWei – Zhang has full access to MyCompany0. Zhang has no identity-based policies, but the MyCompany0 resource-based policy allows him full access to the resource. Zhang can also perform list and read actions on Resource Y.

Identity-based policies and resource-based policies are both permissions policies and are evaluated together. For a request to which only permissions policies apply, AWS first checks all policies for a 1234567890123. If one exists, then the request is denied. Then AWS checks for each 1234567890124. If at least one policy statement allows the action in the request, the request is allowed. It doesn't matter whether the 1234567890124 is in the identity-based policy or the resource-based policy.

This logic applies only when the request is made within a single AWS account. For requests made from one account to another, the requester in JohnSmith5 must have an identity-based policy that allows them to make a request to the resource in JohnSmith6. Also, the resource-based policy in JohnSmith6 must allow the requester in JohnSmith5 to access the resource. There must be policies in both accounts that allow the operation, otherwise the request fails. For more information about using resource-based policies for cross-account access, see How IAM roles differ from resource-based policies.

A user who has specific permissions might request a resource that also has a permissions policy attached to it. In that case, AWS evaluates both sets of permissions when determining whether to grant access to the resource. For information about how policies are evaluated, see Policy evaluation logic.

Amazon S3 supports identity-based policies and resource-based policies (referred to as bucket policies). In addition, Amazon S3 supports a permission mechanism known as an access control list (ACL) that is independent of IAM policies and permissions. You can use IAM policies in combination with Amazon S3 ACLs. For more information, see Access Control in the Amazon Simple Storage Service User Guide.

What are the two types of IAM managed policies?

Identity-based policies There are two types of managed policies: AWS managed policies – Managed policies that are created and managed by AWS. Customer managed policies – Managed policies that you create and manage in your AWS account.

What are the different types of IAM policies?

In this blog post, you learned about four different policy types: identity-based policies, resource-based policies, service control policies (SCPs), and permissions boundary policies.

What are two types of access for IAM user?

Temporary IAM user permissions – An IAM user or role can assume an IAM role to temporarily take on different permissions for a specific task. Cross-account access – You can use an IAM role to allow someone (a trusted principal) in a different account to access resources in your account.

What are the two types of access that is granted to users when an IAM policy is created?

When creating an IAM policy, a user can be granted AWS management console access and programmatic access.