{"id":9532,"library":"aws-solutions-constructs-core","title":"AWS Solutions Constructs Core","description":"The `aws-solutions-constructs-core` library provides base classes, helper functions, and common utilities for building and extending AWS Solutions Constructs patterns. It simplifies the creation of well-architected AWS infrastructure using the AWS Cloud Development Kit (CDK). Currently at version 2.101.0, it maintains a rapid release cadence, often updated weekly or bi-weekly to align with `aws-cdk-lib` releases.","status":"active","version":"2.101.0","language":"en","source_language":"en","source_url":"https://github.com/awslabs/aws-solutions-constructs.git","tags":["aws","cdk","cloud","infrastructure-as-code","constructs","serverless","solution-architecture","patterns"],"install":[{"cmd":"pip install aws-solutions-constructs-core","lang":"bash","label":"Install core library"}],"dependencies":[{"reason":"This library is built on top of the AWS CDK and requires a compatible version of `aws-cdk-lib` to function correctly. Version alignment is critical.","package":"aws-cdk-lib","optional":false},{"reason":"Provides the base Construct class used by CDK and all L3 constructs, typically installed as a dependency of `aws-cdk-lib`.","package":"constructs","optional":false}],"imports":[{"note":"Base class for creating new Solutions Constructs patterns.","symbol":"SolutionConstruct","correct":"from aws_solutions_constructs.aws_solutions_constructs_core import SolutionConstruct"},{"note":"A common utility function to apply tags to any CDK construct.","symbol":"add_tags","correct":"from aws_solutions_constructs.aws_solutions_constructs_core import add_tags"},{"note":"Helper function for consistently creating Lambda functions with common best practices.","symbol":"build_lambda_function","correct":"from aws_solutions_constructs.aws_solutions_constructs_core import build_lambda_function"}],"quickstart":{"code":"import os\nfrom aws_cdk import (\n    App,\n    Stack,\n    aws_lambda as _lambda,\n)\nfrom constructs import Construct\nfrom aws_solutions_constructs.aws_solutions_constructs_core import add_tags\n\nclass MyCoreUsageStack(Stack):\n    def __init__(self, scope: Construct, id: str, **kwargs) -> None:\n        super().__init__(scope, id, **kwargs)\n\n        # Create a basic Lambda function\n        my_function = _lambda.Function(\n            self, \"MyFunction\",\n            runtime=_lambda.Runtime.PYTHON_3_9,\n            handler=\"index.handler\",\n            code=_lambda.Code.from_inline(\"def handler(event, context): return 'Hello from Lambda!'\")\n        )\n\n        # Use a utility from aws_solutions_constructs_core to add tags to the Lambda\n        # add_tags is often used implicitly by pattern constructs, but can be used directly.\n        add_tags(my_function, {\n            \"Project\": \"MyCDKApp\",\n            \"Environment\": \"Development\"\n        })\n\napp = App()\nMyCoreUsageStack(app, \"MyCoreUsageStack\", env={\n    'account': os.environ.get('CDK_DEFAULT_ACCOUNT', ''),\n    'region': os.environ.get('CDK_DEFAULT_REGION', 'us-east-1')\n})\napp.synth()\n","lang":"python","description":"This quickstart demonstrates using `aws-solutions-constructs-core.add_tags` to apply standardized tags to a simple AWS Lambda function within an AWS CDK stack. This highlights how core utilities can be directly leveraged alongside standard CDK resources."},"warnings":[{"fix":"Always align your `aws-cdk-lib` version with the `aws-solutions-constructs-core` version (e.g., if constructs is `2.x.y`, install `aws-cdk-lib==2.x.y` or within its specified compatible range). Check the `pyproject.toml` or `setup.py` for exact dependencies.","message":"AWS Solutions Constructs are tightly coupled to specific versions of `aws-cdk-lib`. Mismatched versions can lead to runtime errors, API inconsistencies, or unexpected behavior.","severity":"breaking","affected_versions":"All versions, especially across major/minor CDK updates."},{"fix":"If you are looking for pre-built, high-level patterns (e.g., API Gateway to Lambda), use specific pattern libraries like `aws-solutions-constructs.aws_apigateway_lambda`. `core` is for building *your own* constructs or using specific helper methods.","message":"The `aws-solutions-constructs-core` library provides base classes and helper functions. It is not designed to be instantiated directly for full patterns. Instead, it's used to extend or assist with other `aws-solutions-constructs.*` pattern libraries.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Prefer using the construct's provided properties and methods for configuration. If direct L1/L2 access is critical, carefully review the construct's documentation and consider the implications for future upgrades.","message":"Solutions Constructs abstracts away many underlying L1/L2 details for simplicity. If you need fine-grained control or access to low-level CloudFormation properties, you might need to use `.node.default_child` or similar, which can bypass the construct's intended abstraction and lead to future compatibility issues.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Check the `aws-solutions-constructs-core` package's `pyproject.toml` or PyPI page for its `Requires-Dist` or `aws-cdk-lib` dependency range. Install a compatible `aws-cdk-lib` version, e.g., `pip install aws-cdk-lib==2.101.0`.","cause":"`aws-cdk-lib` version incompatibility. The Solutions Constructs library expects specific CDK API versions.","error":"AttributeError: 'CfnBucket' object has no attribute 'bucket_name'"},{"fix":"Ensure the package is installed: `pip install aws-solutions-constructs-core`. Verify the import statement matches the full module path: `from aws_solutions_constructs.aws_solutions_constructs_core import ...`.","cause":"The `aws-solutions-constructs-core` package is either not installed or the import path is incorrect.","error":"ModuleNotFoundError: No module named 'aws_solutions_constructs.aws_solutions_constructs_core'"},{"fix":"Ensure `aws-cdk-lib` and `aws-solutions-constructs-core` are compatible versions, as `aws-cdk-lib` typically handles the `constructs` dependency. When creating new constructs, always pass `self` (the current construct scope) as the first argument.","cause":"Often arises from a version mismatch between `aws-cdk-lib` and the underlying `constructs` package, or passing an object of the wrong type where a `constructs.Construct` is expected by a Solutions Construct.","error":"TypeError: Expected an instance of constructs.Construct, got <aws_cdk.aws_lambda.Function object at ...>"}]}