{"id":8850,"library":"aws-cdk-aws-amplify-alpha","title":"AWS CDK Amplify Alpha","description":"The `aws-cdk-aws-amplify-alpha` library provides experimental higher-level constructs (L2 and L3) for provisioning AWS Amplify applications using the AWS Cloud Development Kit (CDK). As an alpha module, its APIs are under active development and are subject to non-backward compatible changes or removal in future versions, not adhering to strict Semantic Versioning. It enables a Git-based workflow for deploying and hosting full-stack serverless web applications. The current version is `2.250.0a0`, typically mirroring the `aws-cdk-lib` release cadence with an alpha qualifier.","status":"active","version":"2.250.0a0","language":"en","source_language":"en","source_url":"https://github.com/aws/aws-cdk.git","tags":["aws-cdk","amplify","iac","cloud-development-kit","aws","alpha","experimental"],"install":[{"cmd":"pip install aws-cdk.aws-amplify-alpha","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Core AWS CDK library, required for deploying CDK applications.","package":"aws-cdk-lib","optional":false},{"reason":"Often used for defining build specifications for Amplify applications.","package":"aws-cdk.aws-codebuild","optional":true},{"reason":"Used for securely storing Git OAuth tokens (e.g., GitHub, GitLab).","package":"aws-cdk.aws-secretsmanager","optional":true}],"imports":[{"note":"Alpha constructs reside in `aws_amplify_alpha` namespace, not `aws_amplify` (which is for L1 CloudFormation constructs or stable L2 constructs if they exist).","wrong":"from aws_cdk.aws_amplify import App","symbol":"App","correct":"from aws_cdk import aws_amplify_alpha as amplify\n\namplify_app = amplify.App(...)"},{"symbol":"GitHubSourceCodeProvider","correct":"from aws_cdk import aws_amplify_alpha as amplify\n\nprovider = amplify.GitHubSourceCodeProvider(...)"}],"quickstart":{"code":"import os\nfrom aws_cdk import (\n    App, Stack, SecretValue\n)\nfrom aws_cdk import aws_amplify_alpha as amplify\nfrom aws_cdk import aws_codebuild as codebuild\n\nclass AmplifyStack(Stack):\n    def __init__(self, scope: App, id: str, **kwargs) -> None:\n        super().__init__(scope, id, **kwargs)\n\n        github_token = SecretValue.secrets_manager(\"my-github-token\") # Store your GitHub token in AWS Secrets Manager\n        github_owner = os.environ.get('GITHUB_OWNER', 'your-github-username')\n        github_repo = os.environ.get('GITHUB_REPO', 'your-amplify-repo')\n\n        amplify_app = amplify.App(\n            self, \"MyApp\",\n            source_code_provider=amplify.GitHubSourceCodeProvider(\n                owner=github_owner,\n                repository=github_repo,\n                oauth_token=github_token\n            ),\n            build_spec=codebuild.BuildSpec.from_object_to_yaml({\n                \"version\": \"1.0\",\n                \"frontend\": {\n                    \"phases\": {\n                        \"preBuild\": {\n                            \"commands\": [\"yarn\"]\n                        },\n                        \"build\": {\n                            \"commands\": [\"yarn build\"]\n                        }\n                    },\n                    \"artifacts\": {\n                        \"baseDirectory\": \"public\",\n                        \"files\": [\"**/*\"]\n                    }\n                }\n            })\n        )\n\n        amplify_app.add_branch(\"main\")\n\napp = App()\nAmplifyStack(app, \"AmplifyQuickstartStack\",\n             env={'account': os.environ.get('CDK_DEFAULT_ACCOUNT'), 'region': os.environ.get('CDK_DEFAULT_REGION')})\napp.synth()","lang":"python","description":"This quickstart demonstrates how to create an AWS Amplify App using the `aws-cdk-aws-amplify-alpha` library. It sets up a GitHub-connected application with a basic build specification. Ensure you have your GitHub OAuth token stored in AWS Secrets Manager and your `GITHUB_OWNER` and `GITHUB_REPO` environment variables set. You will also need to have `aws-cdk-lib` and `aws-cdk.aws-codebuild` installed."},"warnings":[{"fix":"Review release notes and changelogs (`CHANGELOG.v2.alpha.md` in the AWS CDK GitHub repository) for breaking changes before upgrading. Update your code accordingly.","message":"As an `alpha` module, the APIs are experimental and subject to non-backward compatible changes or removal in any future version, without adhering to Semantic Versioning.","severity":"breaking","affected_versions":"All alpha versions (2.x.y-alpha.z)"},{"fix":"If you use `WEB_COMPUTE` or `WEB_DYNAMIC` platforms, be aware that a compute role will now be created. Review IAM policies and ensure appropriate permissions are granted or restricted for this newly created role.","message":"A recent breaking change affects compute role creation when the `platform` property is set to `Platform.WEB_COMPUTE` or `Platform.WEB_DYNAMIC`, leading to the creation of a compute role.","severity":"breaking","affected_versions":"2.249.0a0 and newer (check changelog for exact version)"},{"fix":"To modify an existing Amplify App, you typically need to define it within your CDK stack and then apply changes. If you need to integrate with an existing app for read-only purposes, the `from_app_id` method is appropriate.","message":"When fetching an existing Amplify app using `amplify.App.from_app_id()`, the returned object (`IApp`) provides a read-only reference. You cannot use it to modify the existing Amplify App, such as adding domains or branches directly through this imported reference.","severity":"gotcha","affected_versions":"All alpha versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `cdk bootstrap aws://<YOUR_AWS_ACCOUNT_ID>/<YOUR_AWS_REGION>` in your terminal, replacing placeholders with your actual AWS account ID and region. Ensure your IAM user/role has permissions to perform bootstrapping operations.","cause":"The AWS CDK requires your environment (AWS account and region) to be bootstrapped before deploying resources, which creates a `CDKToolkit` stack with necessary resources like an S3 bucket for assets and IAM roles.","error":"This AWS account and region has not been bootstrapped. Caused By: Is account *********** bootstrapped Resolution: Run `cdk bootstrap aws://{YOUR_ACCOUNT_ID}/{YOUR_REGION}` locally to resolve this."},{"fix":"Review the CloudFormation stack events in the AWS console for specific `AccessDenied` errors to identify missing permissions. Grant the required IAM permissions to the deploying entity. Ensure the OAuth token used for source control (e.g., GitHub) has appropriate repository access scopes.","cause":"The IAM user or role executing the CDK deployment lacks the necessary permissions to create, update, or delete the AWS resources defined in the Amplify stack.","error":"You don't have permissions to perform this action. Verify that your IAM policy includes the required permissions."},{"fix":"This issue might be version-specific or require specific transitive dependencies. Ensure your `aws-cdk-lib` and `aws-cdk.aws-amplify-alpha` versions are compatible. If the issue persists, check the official AWS CDK GitHub issues for `aws-amplify-alpha` regarding asset deployment or `add_branch` for updates or workarounds. This might require updating `npm` packages within the CDK toolkit environment if it's a `jsii`-related problem.","cause":"This error, particularly observed with `amplify_app.add_branch` when deploying from assets, indicates a potential missing internal dependency related to custom resource handlers.","error":"Cannot find entry file at C:\\Users\\user1\\AppData\\Local\\Temp\\jsii-kernel-1N88ev\\node_modules@aws-cdk\\custom-resource-handlers\\dist\\aws-amplify-alpha\\asset-deployment-handler\\index.js"}]}