Skip to content
GitHubXDiscord

IdentityPoolPrincipalTag

The IdentityPoolPrincipalTag resource allows you to manage principal tags for AWS Cognito Identity Pools. These tags are used to control access to resources in AWS based on user attributes. For more information, refer to the AWS Cognito IdentityPoolPrincipalTags documentation.

Create a basic IdentityPoolPrincipalTag with required properties.

import AWS from "alchemy/aws/control";
const identityPoolPrincipalTag = await AWS.Cognito.IdentityPoolPrincipalTag("exampleIdentityPoolTag", {
PrincipalTags: {
"Role": "User",
"Department": "Engineering"
},
IdentityProviderName: "Cognito",
IdentityPoolId: "us-east-1:example-pool-id"
});

Configure an IdentityPoolPrincipalTag using defaults and additional principal tags.

const advancedIdentityPoolPrincipalTag = await AWS.Cognito.IdentityPoolPrincipalTag("advancedIdentityPoolTag", {
PrincipalTags: {
"Role": "Admin",
"Project": "Alpha"
},
UseDefaults: true, // Use default tags
IdentityProviderName: "Cognito",
IdentityPoolId: "us-east-1:example-pool-id"
});

If you want to adopt an existing IdentityPoolPrincipalTag without failing when it already exists, you can set the adopt property to true.

const adoptExistingIdentityPoolPrincipalTag = await AWS.Cognito.IdentityPoolPrincipalTag("existingIdentityPoolTag", {
PrincipalTags: {
"Role": "Viewer"
},
IdentityProviderName: "Cognito",
IdentityPoolId: "us-east-1:example-pool-id",
adopt: true // Adopt existing resource
});