Skip to main content

Anvil — secure-by-default cloud infrastructure components

Project description

anvil-cloud

Cloud infrastructure that's secure by default — not by accident.

Anvil wraps raw cloud resources into opinionated, production-ready components. No boilerplate. No copy-pasting security configs. Just declare what you need.

Built on Pulumi.

Install

pip install anvil-cloud

Secure by default

Every Anvil component ships with defaults aligned to production from day one — public access blocked, encryption enforced, cost tags applied. The goal isn't to make compliance automatic, but to make it a platform you can actually build on.

The App class

Every Anvil program starts with anvil.App(). The run callback receives a Context with:

  • ctx.stage — current deployment stage (defaults to your OS username for dev isolation)
  • ctx.project — project name from anvil.yaml
  • ctx.export(name, value) — export stack outputs
  • ctx.providers — named cloud providers for multi-region / multi-account

Grants

Grants are how Anvil wires permissions between resources. Instead of writing IAM policies by hand, you call .grant() on a resource and Anvil handles both the IAM role policy and the environment variable injection automatically.

A Lambda reading from a Bucket:

import anvil_cloud as anvil

def infra(ctx: anvil.Context):
    bucket = anvil.aws.Bucket("uploads",
        data_classification="sensitive",
    )

    fn = anvil.aws.Lambda("processor",
        runtime="nodejs20.x",
        handler="index.handler",
        code="./src",
    )

    # Grants the Lambda read access to the bucket and scopes down to specific bucket paths.
    # Anvil creates the IAM policy and injects UPLOADS_BUCKET_NAME
    # into the Lambda's environment automatically.
    bucket.grant(fn, actions=["read"], path=["user/*"])

anvil.App(run=infra)

What Anvil does under the hood:

  • Creates an IAM RolePolicy scoped to the exact actions requested
  • Injects the resource identifier as an environment variable on the target (e.g. UPLOADS_BUCKET_NAME)
  • No manual ARN wiring, no forgotten permissions

SvelteKit deployment

Deploy a SvelteKit app to AWS with a single component. Anvil provisions S3, CloudFront, ACM, Lambda (via Lambda Web Adapter), and Route53 — with HTTPS and a custom domain out of the box:

import anvil_cloud as anvil

def infra(ctx: anvil.Context):
    site = anvil.aws.SvelteKitSite("web",
        domain="myapp.com",
    )
    ctx.export("url", site.url)

anvil.App(run=infra)

Overrides

Every component accepts a transform argument to override the underlying resource config when you need to break from the defaults:

bucket = anvil.aws.Bucket("custom",
    data_classification="non-sensitive",
    transform=anvil.aws.BucketTransformArgsArgs(
        overrides=anvil.aws.BucketOverridesArgs(
            force_destroy=True,
            tags={"env": "dev"},
        ),
    ),
)

Requirements

  • Python >= 3.8
  • Pulumi >= 3.0.0
  • Anvil CLI: curl -fsSL https://raw.githubusercontent.com/DamienPace15/anvil/master/install.sh | sh

Links

License

Apache-2.0

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

anvil_cloud-0.0.12.tar.gz (43.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anvil_cloud-0.0.12-py3-none-any.whl (50.5 kB view details)

Uploaded Python 3

File details

Details for the file anvil_cloud-0.0.12.tar.gz.

File metadata

  • Download URL: anvil_cloud-0.0.12.tar.gz
  • Upload date:
  • Size: 43.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for anvil_cloud-0.0.12.tar.gz
Algorithm Hash digest
SHA256 2bf5e49817b3ba1d65f249752a87921313d4d87f760abd46c85b24956202b245
MD5 2c5f5243e8f65cfedae15d9d4e74c0a9
BLAKE2b-256 ef22ce723eec61f6ae018a26e73d30b33b2b65b6fb30731dcbd910d49d1d76b9

See more details on using hashes here.

File details

Details for the file anvil_cloud-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: anvil_cloud-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 50.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for anvil_cloud-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 139fb35cc1c605f32756bdf0bde32ecba00b4031ba25579acdd6c77bb7004125
MD5 1059d6b1af3d47a94714566648a1e665
BLAKE2b-256 90fefcb8b1219d92b7e1f83ac0404b09c37b2b33e783676bd1848afc9a90bbef

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