Skip to main content

AWS Access Policy Language creation library

Project description

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.

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 IAM_ARN
from awacs.s3 import 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"
}
```

[AWS IAM]: http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

awacs-0.3.0.tar.gz (11.9 kB view details)

Uploaded Source

File details

Details for the file awacs-0.3.0.tar.gz.

File metadata

  • Download URL: awacs-0.3.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for awacs-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8d11c1d8de821a2943faecb417540fe9951955b52995b0af9b7dfd59818901ab
MD5 2cb1415b285196deafb2d97c9c7e5417
BLAKE2b-256 af98f2c2a51cda65d412cdcdff665e530fa0b8e656aa097eba6732c8f3a3ca03

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page