AWS Amazon Cognito Identity Pool Roles Attachment

This page shows how to write Terraform and CloudFormation for Amazon Cognito Identity Pool Roles Attachment and write them securely.

aws_cognito_identity_pool_roles_attachment (Terraform)

The Identity Pool Roles Attachment in Amazon Cognito can be configured in Terraform with the resource name aws_cognito_identity_pool_roles_attachment. The following sections describe 3 examples of how to use the resource and its parameters.

Example Usage from GitHub

roles-attachment.tf#L1
resource "aws_cognito_identity_pool_roles_attachment" "main" {
  identity_pool_id = aws_cognito_identity_pool.identity-pool.id
  roles = {
    "authenticated" = aws_iam_role.authenticated.arn
  }
}
cognito.tf#L17
resource "aws_cognito_identity_pool_roles_attachment" "main" {
  identity_pool_id = aws_cognito_identity_pool.pool.id
  roles = {
    "authenticated" = aws_iam_role.lambda_exec.arn
  }
}
main.tf#L1
resource "aws_cognito_identity_pool_roles_attachment" "roles_attachment" {
  identity_pool_id = var.identity_pool_id

  role_mapping {
    identity_provider         = var.identity_provider
    ambiguous_role_resolution = var.ambiguous_role_resolution

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides an AWS Cognito Identity Pool Roles Attachment.

AWS::Cognito::IdentityPoolRoleAttachment (CloudFormation)

The IdentityPoolRoleAttachment in Cognito can be configured in CloudFormation with the resource name AWS::Cognito::IdentityPoolRoleAttachment. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

IdentityRoleMapping.yml#L4
    Type: "AWS::Cognito::IdentityPoolRoleAttachment"
    Properties:
      IdentityPoolId: !Ref IdentityPool
      Roles:
        authenticated: !GetAtt CognitoAuthorizedRole.Arn
CognitoIdentityPoolRoles.yml#L2
  Type: AWS::Cognito::IdentityPoolRoleAttachment
  Properties:
    IdentityPoolId:
      Ref: CognitoIdentityPool
    Roles:
      authenticated:
CognitoIdentityPoolRoles.yml#L2
  Type: AWS::Cognito::IdentityPoolRoleAttachment
  Properties:
    IdentityPoolId:
      Ref: CognitoIdentityPool
    Roles:
      authenticated:
IdentityPoolRoleMapping.yml#L1
Type: "AWS::Cognito::IdentityPoolRoleAttachment"
Properties:
  IdentityPoolId: !Ref CognitoIdentityPool
  Roles:
    authenticated: !GetAtt CognitoAuthorizedRole.Arn
identity-pool-role-mapping.yml#L1
Type: AWS::Cognito::IdentityPoolRoleAttachment
Properties:
  IdentityPoolId: { Ref: IdentityPool }
  Roles:
template.json#L42
      "Type": "AWS::Cognito::IdentityPoolRoleAttachment",
      "Properties": {
        "IdentityPoolId": {
          "Ref": "IdentityPoolStack"
        },
        "Roles": {
template.json#L42
      "Type": "AWS::Cognito::IdentityPoolRoleAttachment",
      "Properties": {
        "IdentityPoolId": {
          "Ref": "IdentityPool"
        },
        "Roles": {
role-attachment-hack-use.json#L29
    "Type": "AWS::Cognito::IdentityPoolRoleAttachment",
    "Properties": {
      "IdentityPoolId": {
        "Ref": "CognitoIdentityPool"
      },
      "RoleMappings": {
3.clf-cognnito-rolemapping.json#L17
      "Type":"AWS::Cognito::IdentityPoolRoleAttachment",
      "Properties":{
         "IdentityPoolId":{
            "Ref":"IdentityPool"
         },
         "Roles":{
cognito-tmp.json#L11
      "Type": "AWS::Cognito::IdentityPoolRoleAttachment",
      "Properties": {
        "IdentityPoolId": {
          "Ref": "IdPool"
        },
        "Roles": {

Parameters

Explanation in CloudFormation Registry

The AWS::Cognito::IdentityPoolRoleAttachment resource manages the role configuration for an Amazon Cognito identity pool.

Frequently asked questions

What is AWS Amazon Cognito Identity Pool Roles Attachment?

AWS Amazon Cognito Identity Pool Roles Attachment is a resource for Amazon Cognito of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon Cognito Identity Pool Roles Attachment?

For Terraform, the dasmeta/terraform-aws-modules, ReeceRose/home-network-proxy and cloudveto/terraform-modules source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the Ankcorn/serverless-fullstack-example-app, geeksforinnovations/serverless_online_sastry and geeksforinnovations/Common-utilities source code examples are useful. See the CloudFormation Example section for further details.