{"id":8854,"library":"aws-cdk-aws-codestar-alpha","title":"AWS CDK CodeStar (Alpha)","description":"The `aws-cdk-aws-codestar-alpha` library provides AWS Cloud Development Kit (CDK) constructs for interacting with AWS CodeStar. As an 'alpha' module, its APIs are subject to breaking changes and are not recommended for production use. It is currently at version `2.250.0a0` and follows the rapid release cadence of the AWS CDK v2.","status":"active","version":"2.250.0a0","language":"en","source_language":"en","source_url":"https://github.com/aws/aws-cdk.git","tags":["aws","cdk","cloud","infrastructure","iac","codestar","alpha"],"install":[{"cmd":"pip install aws-cdk-aws-codestar-alpha","lang":"bash","label":"Install the alpha construct"},{"cmd":"pip install aws-cdk-lib","lang":"bash","label":"Install core CDK library (if not already)"}],"dependencies":[{"reason":"Core AWS CDK library for defining stacks and constructs.","package":"aws-cdk-lib","optional":false}],"imports":[{"note":"Alpha modules use a distinct import path (`_alpha`) and often contain only L1 CloudFormation constructs (prefixed `Cfn`) before L2 constructs are developed.","wrong":"from aws_cdk.aws_codestar import Project","symbol":"CodeStarAlpha","correct":"import aws_cdk.aws_codestar_alpha as codestar_alpha"},{"note":"CDK v2 changed core imports; `aws_cdk.core` is deprecated. Import `App`, `Stack`, `Environment` directly from `aws_cdk`.","wrong":"import aws_cdk.core as cdk","symbol":"App, Stack","correct":"from aws_cdk import App, Stack, Environment"}],"quickstart":{"code":"import os\nfrom aws_cdk import (\n    App, Stack, Environment\n)\nimport aws_cdk.aws_codestar_alpha as codestar_alpha\n\nclass MyCodeStarStack(Stack):\n    def __init__(self, scope: App, id: str, **kwargs) -> None:\n        super().__init__(scope, id, **kwargs)\n\n        # IMPORTANT: This is an L1 CloudFormation construct. It requires\n        # actual GitHub credentials and repository details for successful deployment.\n        # Store sensitive data in environment variables or AWS Secrets Manager.\n        github_access_token = os.environ.get(\"GITHUB_ACCESS_TOKEN\", \"YOUR_GITHUB_PERSONAL_ACCESS_TOKEN\")\n        github_owner = os.environ.get(\"GITHUB_OWNER\", \"your-github-username\")\n        repository_name = os.environ.get(\"GITHUB_REPO_NAME\", \"my-codestar-repo\")\n\n        if github_access_token == \"YOUR_GITHUB_PERSONAL_ACCESS_TOKEN\":\n            print(\"WARNING: GITHUB_ACCESS_TOKEN not set. This construct will likely fail deployment.\")\n\n        # Define a GitHub repository resource for CodeStar\n        # This resource integrates an existing GitHub repo with AWS CodeStar.\n        codestar_alpha.CfnGitHubRepository(self, \"MyGitHubRepo\",\n            repository_name=repository_name,\n            owner=github_owner,\n            repository_access_token=github_access_token,\n            # is_private=True, # Optional\n            # repository_description=\"My CodeStar managed GitHub repository\" # Optional\n        )\n\napp = App()\nMyCodeStarStack(app, \"MyCodeStarStack\",\n    env=Environment(account=os.environ.get(\"CDK_DEFAULT_ACCOUNT\"), region=os.environ.get(\"CDK_DEFAULT_REGION\"))\n)\napp.synth()\n","lang":"python","description":"This quickstart defines a basic CDK stack that includes a `CfnGitHubRepository` from the `aws-cdk-aws-codestar-alpha` module. Note that `CfnGitHubRepository` is an L1 (CloudFormation-level) construct and requires actual GitHub credentials (Personal Access Token) and repository details (owner, name) to be configured, typically via environment variables, for successful deployment. Remember to set `CDK_DEFAULT_ACCOUNT` and `CDK_DEFAULT_REGION`."},"warnings":[{"fix":"Review release notes for each update. Pin exact alpha versions to avoid unexpected changes. Plan for refactoring if upgrading.","message":"This module is in 'alpha' status. Its APIs are unstable, subject to breaking changes without major version bumps, and should not be used in production environments.","severity":"breaking","affected_versions":"All alpha versions (e.g., 2.x.x.a0)"},{"fix":"Carefully review the construct's properties in the AWS CDK API documentation. Be prepared to provide all required CloudFormation properties directly. Consider using a stable CDK service module if L2 constructs are required.","message":"Alpha modules often initially provide only L1 (CloudFormation-level) constructs (prefixed with `Cfn`). These require detailed, low-level configuration and may not offer the higher-level abstractions found in stable L2 constructs.","severity":"gotcha","affected_versions":"All alpha versions (e.x. 2.x.x.a0)"},{"fix":"Ensure your project's `aws-cdk-lib` dependency is at version 2.x.x. Use `pip freeze | grep aws-cdk` to verify.","message":"AWS CDK v1 and v2 are incompatible. Alpha constructs like `aws-cdk-aws-codestar-alpha` are built for CDK v2 and require `aws-cdk-lib` (v2) as a dependency. Attempting to use them with CDK v1 will result in errors.","severity":"breaking","affected_versions":"v2.x.x.a0 when used with AWS CDK v1"},{"fix":"Ensure the IAM role used by CDK (often `cdk-hnb659fds` for `cdk deploy` or your execution role) has the necessary permissions for AWS CodeStar and any related services (e.g., IAM, CloudFormation, CodeBuild, CodePipeline, S3). Check CloudTrail logs for specific access denied errors.","message":"CDK deployments often fail due to insufficient AWS IAM permissions for the default roles, especially when creating or modifying specialized resources like CodeStar projects or connections.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install aws-cdk-aws-codestar-alpha` and ensure you are using the correct Python environment where it's installed.","cause":"The `aws-cdk-aws-codestar-alpha` package is not installed or the Python environment is incorrect.","error":"ModuleNotFoundError: No module named 'aws_cdk.aws_codestar_alpha'"},{"fix":"Consult the latest AWS CDK API documentation for `aws_cdk.aws_codestar_alpha` to verify construct properties and their types. Ensure all required properties are provided.","cause":"This often occurs in alpha modules when an expected property is missing, or the API has changed. It's a common symptom of using an outdated construct definition or missing a required attribute.","error":"jsii.errors.JavaScriptError: TypeError: Cannot read properties of undefined (reading 'someProperty')"},{"fix":"Ensure you are passing the `self` (or another valid parent construct) as the first argument to the construct's `__init__` method, followed by an `id` and optional keyword arguments: `MyConstruct(self, 'MyId', ...)`.","cause":"This error typically indicates that a CDK construct or stack constructor is being called incorrectly, missing the `scope` (parent construct) argument.","error":"TypeError: __init__ missing 1 required positional argument: 'scope'"},{"fix":"Provide a valid, non-empty value for `repository_access_token` (and other required properties) to the `CfnGitHubRepository` construct. Use environment variables or Secrets Manager for sensitive data.","cause":"For L1 constructs like `CfnGitHubRepository`, all required CloudFormation properties must be explicitly provided, including sensitive ones like access tokens.","error":"Validation failed with following errors: [The 'repositoryAccessToken' property requires a value.]"}]}