Skip to content
GitHubXDiscordRSS

IdentityPool

Learn how to create, update, and manage AWS Cognito IdentityPools using Alchemy Cloud Control.

The IdentityPool resource allows you to manage AWS Cognito IdentityPools for user authentication and access management in your applications.

Create a basic IdentityPool with the required properties and a common optional property.

import AWS from "alchemy/aws/control";
const identityPool = await AWS.Cognito.IdentityPool("myIdentityPool", {
IdentityPoolName: "MyAppIdentityPool",
AllowUnauthenticatedIdentities: true,
DeveloperProviderName: "my-developer-provider"
});

Configure an IdentityPool with additional options such as supported login providers and Cognito events.

const advancedIdentityPool = await AWS.Cognito.IdentityPool("advancedIdentityPool", {
IdentityPoolName: "AdvancedAppIdentityPool",
AllowUnauthenticatedIdentities: false,
CognitoIdentityProviders: [
{
ProviderName: "cognito-idp.us-west-2.amazonaws.com/us-west-2_aBcDeFgHi",
ClientId: "1234567890abcdefg"
}
],
CognitoEvents: {
onLogin: "arn:aws:lambda:us-west-2:123456789012:function:onLogin"
},
SupportedLoginProviders: {
"graph.facebook.com": "1234567890123456"
}
});

Create an IdentityPool that includes SAML provider ARNs for federated authentication.

const samlIdentityPool = await AWS.Cognito.IdentityPool("samlIdentityPool", {
IdentityPoolName: "SAMLAppIdentityPool",
AllowUnauthenticatedIdentities: true,
SamlProviderARNs: [
"arn:aws:cognito:saml-provider/MySAMLProvider"
]
});

Set up an IdentityPool to utilize Cognito Streams for real-time data processing.

const streamIdentityPool = await AWS.Cognito.IdentityPool("streamIdentityPool", {
IdentityPoolName: "StreamAppIdentityPool",
AllowUnauthenticatedIdentities: false,
CognitoStreams: {
RoleArn: "arn:aws:iam::123456789012:role/CognitoStreamRole",
StreamName: "CognitoStream",
StreamingStatus: "ENABLED"
}
});