AWS CDK Cognito Identity Pool Alpha

raw JSON →
2.186.0a0 verified Fri May 01 auth: no python deprecated

This is a deprecated Alpha module for AWS CDK that provided L2 constructs for Amazon Cognito Identity Pools. As of version 2.186.0a0, the constructs have been moved to the stable aws-cdk-lib/aws-cognito-identitypool module. The module is in maintenance mode and will not receive further updates. Users are strongly advised to migrate to the stable module.

pip install aws-cdk-aws-cognito-identitypool-alpha
error ModuleNotFoundError: No module named 'aws_cdk.aws_cognito_identitypool_alpha'
cause The alpha module is not installed or is deprecated.
fix
Install the package: pip install aws-cdk-aws-cognito-identitypool-alpha. For new projects, use aws_cdk.aws_cognito_identitypool instead.
error AttributeError: module 'aws_cdk.aws_cognito_identitypool_alpha' has no attribute 'IdentityPool'
cause The class may have been renamed or moved in a newer version of the package.
fix
Verify the class exists: pip show aws-cdk-aws-cognito-identitypool-alpha and check the correct class name. For migration, use aws_cdk.aws_cognito_identitypool.IdentityPool.
breaking This module is deprecated and will be removed in a future major version. All constructs are now available in the stable aws-cdk-lib/aws-cognito-identitypool module. Migrate as soon as possible.
fix Replace imports from 'aws_cdk.aws_cognito_identitypool_alpha' with 'aws_cdk.aws_cognito_identitypool'. See migration guide: https://docs.aws.amazon.com/cdk/latest/guide/cognito-identitypool.html
deprecated The IdentityPool construct does not support role mapping rules in the same way as the stable module. This may cause unexpected behavior if you rely on advanced role mapping.
fix Use the stable module's IdentityPool which provides a more consistent API for role mappings.
gotcha The import path changed between alpha and stable. 'from aws_cdk.aws_cognito_identitypool_alpha import ...' will not work after migration. Ensure you update all imports and remove the alpha dependency from requirements.
fix Update imports to 'from aws_cdk.aws_cognito_identitypool import ...' and remove 'aws-cdk-aws-cognito-identitypool-alpha' from dependencies.
gotcha The module version (2.186.0a0) corresponds to CDK v2.186.0 alpha. It may not be compatible with newer CDK versions. If using a newer CDK, migrate to stable.
fix Use a compatible version of aws-cdk-lib or migrate to the stable module.

Minimal example of creating an IdentityPool with a Cognito User Pool authentication provider. For new projects, use the stable module aws-cdk-lib/aws-cognito-identitypool.

from aws_cdk import App, Stack
from aws_cdk.aws_cognito_identitypool_alpha import IdentityPool, UserPoolAuthenticationProvider
from aws_cdk.aws_cognito import UserPool

app = App()
stack = Stack(app, "MyStack")

user_pool = UserPool(stack, "MyUserPool")
identity_pool = IdentityPool(
    stack, "MyIdentityPool",
    authentication_providers=[
        UserPoolAuthenticationProvider(user_pool=user_pool)
    ]
)
app.synth()