[!Tip] Migrating from
v0tov1? See Migration Guide.
Opinionated CDK “framework” with constructs & utilities for:
-
deploying multiple environments to multiple accounts (with many-to-many relationship)
-
managing account configuration through standardized props (no more random config files)
-
querying account and/or environment specific information within your CDK code
-
enabling dynamic & short-lived “feature-environments”
-
enabling well-defined tagging
-
providing structure & common conventions to CDK projects
-
choosing the target account & environment by passing in runtime context:
npx cdk deploy -c account=dev -c environment=feature/abc-123
... which means you don't need to define all the possible environments ahead of time!
Account Strategies
Depending on the use case, you may choose a configuration between 1-3 AWS accounts with the following environments:
-
Shared account (
shared): -
Multi-account (
dev+prod)– RECOMMENDED:
-
Multi-account (
dev+preprod+prod):
Getting Started
Steps required to define a environmental project resources; At first, it might seem complex but once you get into the habbit of defining your projects this way it starts to make sense:
-
Choose your Account Strategy
-
Initialize a new
Projectinstead ofcdk.App:// bin/app.ts import { Project, AccountStrategy } from '@alma-cdk/project'; const project = new Project({ // Basic info, you could also read these from package.json if you want name: 'my-cool-project', author: { organization: 'Acme Corp', name: 'Mad Scientists', email: 'mad.scientists@acme.example.com', }, // If not set, defaults to one of: $CDK_DEFAULT_REGION, $AWS_REGION or us-east-1 defaultRegion: 'eu-west-1', // Configures the project to use 2 AWS accounts (recommended) accounts: AccountStrategy.two({ dev: { id: '111111111111', config: { // whatever you want here as [string]: any baseDomain: 'example.net', }, }, prod: { id: '222222222222', config: { // whatever you want here as [string]: any baseDomain: 'example.com', }, }, }), })
-
Define a stack which
extends SmartStackwith resources:// lib/my-stack.ts import { Construct } from 'constructs'; import { StackProps, RemovalPolicy } from 'aws-cdk-lib'; import { SmartStack, Name, UrlName, PathName, EC } from '@alma-cdk/project'; export class MyStack extends SmartStack { constructor(scope: Construct, id: string, props: StackProps) { super(scope, id, props); new dynamodb.Table(this, 'Table', { removalPolicy: EC.isStable(this) ? RemovalPolicy.RETAIN : RemovalPolicy.DESTROY, tableName: Name.it(this, 'MyTable'), partitionKey: { type: dynamodb.AttributeType.STRING, name: 'pk', }, // StagingMyTable }); new events.EventBus(this, 'EventBus', { eventBusName: Name.withProject(this, 'MyEventBus'), // MyCoolProjectStagingMyEventBus }); new s3.Bucket(this, 'Bucket', { removalPolicy: EC.isStable(this) ? RemovalPolicy.RETAIN : RemovalPolicy.DESTROY, autoDeleteObjects: EC.isStable(this) ? false : true, bucketName: UrlName.globally(this, 'MyBucket'), // acme-corp-my-cool-project-feature-foo-bar-my-bucket }); new ssm.StringParameter(this, 'Parameter', { stringValue: 'Foo', tier: ssm.ParameterTier.ADVANCED, parameterName: PathName.withProject(this, 'MyNamespace/MyParameter'), // /MyCoolProject/Staging/MyNamespace/MyParameter }); } }
-
Define a new environmental which
extends EnvironmentWrapperand initialize all your environmentalSmartStackstacks within:// lib/environment.ts import { Construct } from 'constructs'; import { EnvironmentWrapper } from '@alma-cdk/project'; import { MyStack } from './my-stack'; export class Environment extends EnvironmentWrapper { constructor(scope: Construct) { super(scope); new MyStack(this, 'MyStack', { description: 'This is required' }); } }
Resulting Stack properties (given
environment=staging):Property Example value stackName"MyCoolProject-Environment-Staging-MyExampleStack"terminationProtectiontrueenv.account"111111111111"env.region"eu-west-1"Resulting Tags for the Stack and its resources (given
environment=staging):Property Example value AccountdevEnvironmentstagingProjectmy-cool-projectAuthorMad ScientistsOrganizationAcme CorpContactmad.scientists@acme.example.com -
Finally initialize the environment with the
Projectscope:// bin/app.ts import { Project, Accounts } from '@alma-cdk/project'; import { Environment } from '../lib/environment'; const project = new Project({/* removed for brevity, see step 1 */}) new Environment(project);
Documentation
See detailed documentation for specific classes & methods at constructs.dev.
Generally speaking you would be most interested in the following:
- Project
- AccountStrategy
- SmartStack
- AccountWrapper & EnvironmentWrapper
- AccountContext (AC)
- EnvironmentContext (EC)
- Name / UrlName / PathName
Migration Guide
Migrating from v0 to v1? See Migration Guide.
Roadmap
For now, see Issue #36.
Release files for alma-cdk.project 3.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| alma_cdk_project-3.0.1.tar.gz | 1.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| alma_cdk_project-3.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.6 MB
Release files / alma_cdk_project-3.0.1.tar.gz
| Download URL | alma_cdk_project-3.0.1.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bec1d40defa3d9de2bb748ddf3302aaed956d865fdda5649a0e0ef4daaf19d8f
|
|
BLAKE2b-256 checksum How to use checksums |
79c285c9bfb92ba3b5f8ba82135f1f292399e790cd02d242ce84392bf8833e3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.14.6
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 10, 2026.
Transparency logRelease files / alma_cdk_project-3.0.1-py3-none-any.whl
| Download URL | alma_cdk_project-3.0.1-py3-none-any.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2fb6935b380832c3011ef54a97de780a49cdaf4943b1ebf1de35d4f7f229c969
|
|
BLAKE2b-256 checksum How to use checksums |
998eccecddb8d3832f689d8e92e710a075f43433ff32d0b9952939152d97f405
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.14.6
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 10, 2026.
Transparency log