AWS CDK Construct Library for CodeCommit

1.204.0 · active · verified Fri Apr 17

The `aws-cdk-aws-codecommit` library provides AWS Cloud Development Kit (CDK) constructs for defining AWS CodeCommit resources programmatically using Python. It allows developers to create, configure, and manage CodeCommit repositories as part of their infrastructure-as-code deployments. This entry specifically covers version 1.204.0, which is part of the AWS CDK v1 ecosystem. AWS CDK typically follows a rapid release cadence, often with weekly updates for bug fixes and new feature support.

Common errors

Warnings

Install

Imports

Quickstart

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()

view raw JSON →