Git Product home page Git Product logo

awacs's Introduction

awacs

image

image

image

About

awacs - Amazon Web Access Control Subsystem

The awacs library allows for easier creation of AWS Access Policy Language JSON by writing Python code to describe the AWS policies. To facilitate catching policy format or JSON errors early the library has property and type checking built into the classes.

Installation

awacs can be installed using the pip distribution system for python by issuing:

$ pip install awacs

Alternatively, you can run use setup.py to install by cloning this repository and issuing:

# python setup.py install

Examples

An example to use this comes from the AWS IAM documentation. This shows creating policy attached to an Amazon S3 bucket:

from awacs.aws import Action, Allow, Policy, Principal, Statement
from awacs.iam import ARN as IAM_ARN
from awacs.s3  import ARN as S3_ARN

account = "123456789012"
user = "user/Bob"

pd = Policy(
    Version="2012-10-17",
    Id="S3-Account-Permissions",
    Statement=[
        Statement(
            Sid="1",
            Effect=Allow,
            Principal=Principal("AWS", [IAM_ARN(account, user)]),
            Action=[Action("s3", "*")],
            Resource=[S3_ARN("my_corporate_bucket/*"),],
        ),
    ],
)
print(pd.to_json())

would produce this json policy:

{
    "Id": "S3-Account-Permissions", 
    "Statement": [
        {
            "Action": [
                "s3:*"
            ], 
            "Effect": "Allow", 
            "Principal": [
                {
                    "AWS": [
                        "arn:aws:iam:123456789012:user/Bob:"
                    ]
                }
            ], 
            "Resource": [
                "arn:aws:s3::my_corporate_bucket/*:"
            ], 
            "Sid": "1"
        }
    ], 
    "Version": "2012-10-17"
}

Community

We have a google group, cloudtools-dev, where you can ask questions and engage with the cloudtools/awacs community. Issues & pull requests are always welcome!

awacs's People

Contributors

bobveznat avatar craigbruce avatar jonathanq avatar markpeek avatar mdthorpe avatar michellesenar avatar phobologic avatar somcsel avatar

Watchers

 avatar  avatar

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.