Giter Site home page Giter Site logo

aws_notes's Introduction

AWS_notes

IAM

access policy , role , and policy

In the context of AWS, an IAM policy is a document that defines the permissions that are granted to a user, program, or role. These permissions specify what actions the principal is allowed to perform on specific AWS resources. For example, a policy might grant a user permission to read and write to an S3 bucket, or it might grant a program permission to invoke a specific Lambda function.

An access policy, on the other hand, is a policy that is attached to a specific resource, such as an S3 bucket or an SNS topic. This policy specifies which principals are allowed to access the resource and what actions they are allowed to perform on the resource.

In the case of the SNS topic access policy that you provided, the policy specifies that the AWS role with the ARN "arn:aws:iam::302250292538:role/rolelambda2" is allowed to perform the actions listed in the "Action" field. However, the access policy does not grant the role any permissions on its own. In order for the role to be able to actually perform these actions, it must have an attached IAM policy that grants it permission to do so.

For example, consider the following access policy for an SNS topic:

Copy code

    {
    "Version": "2008-10-17",
    "Id": "__default_policy_ID",
    "Statement": [
        {
        "Sid": "__default_statement_ID",
        "Effect": "Allow",
        "Principal": {
            "AWS": "arn:aws:iam::id:role/rolename"
        },
        "Action": [
            "SNS:Publish",
            "SNS:Subscribe"
        ],
        "Resource": "",
        "Condition": {
            "StringEquals": {
            "AWS:SourceOwner": "302250292538"
            }
        }
        }
    ]
    }

In this case, the access policy allows the AWS role with the ARN "arn:aws:iam::302250292538:role/rolelambda2" to publish messages to the SNS topic and to subscribe to the topic. However, in order for the role to actually be able to perform these actions, it must have an attached IAM policy that grants it permission to do so. For example, the role might have an attached policy like this:

Copy code

    {
    "Version": "2012-10-17",
    "Statement": [
        {
        "Effect": "Allow",
        "Action": [
            "SNS:Publish",
            "SNS:Subscribe"
        ],
        "Resource": "*"
        }
    ]
    }

This policy grants the role permission to perform the "SNS:Publish" and "SNS:Subscribe" actions on any SNS topic. With this policy attached to the role, the role will be able to publish messages to and subscribe to the SNS topic specified in the access policy.

In summary, an access policy specifies which principals are allowed to access a resource and what actions they are allowed to perform on the resource. However, in order for a principal to actually be able to perform these actions, it must have an attached IAM policy that grants it permission to do so.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.