Install & Compatibility
Where this runs
tested against v1.204.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 35.3MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 4.5s · import 0.000s · 36MB
35MB installed
● package 35MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Repository
✓ from aws_cdk import aws_codecommit as codecommit
# then: codecommit.Repository(...)
✗ from aws_cdk.aws_codecommit import Repository
This package is for AWS CDK v1. The correct import pattern uses an alias for the module, then accesses classes through that alias. The direct `from ... import ClassName` is the v2 pattern and will cause an AttributeError in v1.
App
✓ from aws_cdk import core as cdk
# then: cdk.App()
✗ from aws_cdk import App
For CDK v1, `App` and `Stack` are typically imported from `aws_cdk.core`. The direct `from aws_cdk import App` is the v2 pattern.
This quickstart defines a basic AWS CDK application that creates a new AWS CodeCommit repository. It includes standard CDK v1 import patterns and outputs the HTTP clone URL for the created repository. Remember to set your AWS credentials and region, either via environment variables (`CDK_DEFAULT_ACCOUNT`, `CDK_DEFAULT_REGION`) or AWS CLI configuration.
import os
from aws_cdk import (
core as cdk,
aws_codecommit as codecommit
)
class CodeCommitStack(cdk.Stack):
def __init__(self, scope: cdk.App, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
# Create a new CodeCommit repository
repo = codecommit.Repository(
self, "MyCodeCommitRepo",
repository_name="my-application-repo"
)
# Output the repository clone URL for convenience
cdk.CfnOutput(
self, "RepositoryCloneUrlHttp",
value=repo.repository_clone_url_http,
description="HTTP URL to clone the CodeCommit repository"
)
app = cdk.App()
CodeCommitStack(
app, "CodeCommitQuickstartStack",
env=cdk.Environment(
account=os.environ.get("CDK_DEFAULT_ACCOUNT", ""),
region=os.environ.get("CDK_DEFAULT_REGION", "us-east-1")
)
)
app.synth()
Debug
Known issues
breakingThis package (`aws-cdk-aws-codecommit==1.204.0`) is part of AWS CDK v1. AWS CDK v2 is the current major version, which introduces significant breaking changes, especially in import paths (`aws-cdk.core` is replaced by `aws_cdk.lib`) and module structure. Code written for v1 is not directly compatible with v2.fixIf starting a new project, consider using AWS CDK v2 (install `aws-cdk-lib` and specific service packages). If maintaining a v1 project, ensure all CDK packages are pinned to v1 versions (e.g., `aws-cdk.core==1.x.x`). For migration, consult the official AWS CDK v2 migration guide.
affects: All versions >= 2.0.0 (for migration)
gotchaCDK applications require the AWS CDK Toolkit (CLI) to be installed globally via Node.js (`npm install -g aws-cdk`). Without it, commands like `cdk synth` or `cdk deploy` will fail.fixInstall the AWS CDK Toolkit: `npm install -g aws-cdk` and ensure Node.js is correctly set up in your PATH.
affects: All versions of AWS CDK
gotchaThe `repository_name` property for a CodeCommit repository must be unique within an AWS account and region. Attempting to deploy a stack with a duplicate repository name will result in a deployment failure.fixChoose a unique and descriptive name for your CodeCommit repository. If deploying multiple instances of the same stack (e.g., for different environments), use context values or a naming convention to ensure uniqueness (e.g., `my-app-repo-dev`, `my-app-repo-prod`).
affects: All versions
gotchaCDK v1 requires an explicit `from aws_cdk import core as cdk` or similar alias for core components like `App` and `Stack`. Many examples on the web for CDK v2 might show `from aws_cdk import App, Stack`, which will not work with v1.fixAlways import `core` as an alias (e.g., `import aws_cdk.core as cdk` or `from aws_cdk import core as cdk`) and use `cdk.App()`, `cdk.Stack()`, etc., for v1 projects.
affects: AWS CDK v1
Upgrade
Version history
1.204.0latest on PyPI · released Jun 19, 2023
Audit
Dependencies
aws-cdk.corerequiredRequired for core CDK constructs like App, Stack, and runtime environment.