All Projects → mikeduminy → serverless-cognito-add-custom-attributes

mikeduminy / serverless-cognito-add-custom-attributes

Licence: MIT license
Add custom attributes to an existing CloudFormation-managed CognitoUserPool from serverless without losing all your users

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to serverless-cognito-add-custom-attributes

serverless-cloudformation-sub-variables
Serverless framework plugin for easily supporting AWS CloudFormation Sub intrinsic function variables
Stars: ✭ 25 (-16.67%)
Mutual labels:  cloudformation
CloudGenesis
Automation for deploying & deleting CloudFormation stacks sourced from a Git repo
Stars: ✭ 34 (+13.33%)
Mutual labels:  cloudformation
cloudniite
AWS Lambda Optimization and Monitoring Tool
Stars: ✭ 25 (-16.67%)
Mutual labels:  cloudformation
aws-cloudformation-resource-providers-cloudformation
The CloudFormation Resource Provider Package For AWS CloudFormation
Stars: ✭ 42 (+40%)
Mutual labels:  cloudformation
bora
A Ruby command line tool and rake tasks for working with cloudformation stacks and cfndsl
Stars: ✭ 18 (-40%)
Mutual labels:  cloudformation
takomo
Organize, parameterize and deploy your CloudFormation stacks
Stars: ✭ 27 (-10%)
Mutual labels:  cloudformation
aws-node-custom-user-pool
Serverless AWS Cognito Custom User Pool Example
Stars: ✭ 15 (-50%)
Mutual labels:  cloudformation
docker-geth-lb
MyEtherWallet AWS set up. Deploy public-facing Ethereum nodes using AWS CloudFormation / Docker / Parity / Geth / ethstats
Stars: ✭ 127 (+323.33%)
Mutual labels:  cloudformation
cloudformation-checklist
The checklist for meticulous AWS DevOps engineers
Stars: ✭ 68 (+126.67%)
Mutual labels:  cloudformation
aws-cloudformation-simplified
AWS CloudFormation - Simplified | Hands On Learning !!
Stars: ✭ 51 (+70%)
Mutual labels:  cloudformation
aws-cloudformation-cognito-identity-pool
A Lambda-backed Custom Resource for a Cognito Identity Pool in CloudFormation
Stars: ✭ 35 (+16.67%)
Mutual labels:  cloudformation
aws-cfn-custom-resource-lambda-edge
🏗 AWS CloudFormation custom resource that allows deploying Lambda@Edge from any region
Stars: ✭ 19 (-36.67%)
Mutual labels:  cloudformation
serverless-rules
Compilation of rules to validate infrastructure-as-code templates against recommended practices for serverless applications.
Stars: ✭ 352 (+1073.33%)
Mutual labels:  cloudformation
LambdaSharpTool
Serverless .NET on AWS - λ# is a CLI and Framework for Rapid Application Development using .NET on AWS
Stars: ✭ 99 (+230%)
Mutual labels:  cloudformation
AWSlack
Get Slack notifications on AWS CloudWatch events
Stars: ✭ 21 (-30%)
Mutual labels:  cloudformation
nfscan
NFScan is a free, open-source software, available to non-profit organizations to receive donations effectively.
Stars: ✭ 85 (+183.33%)
Mutual labels:  cloudformation
typeformation
Type Cloudformation templates with pleasure!
Stars: ✭ 16 (-46.67%)
Mutual labels:  cloudformation
brume
Brume: an AWS CloudFormation deployer
Stars: ✭ 12 (-60%)
Mutual labels:  cloudformation
aws-leastprivilege
Generates an IAM policy for the CloudFormation service role that adheres to least privilege.
Stars: ✭ 85 (+183.33%)
Mutual labels:  cloudformation
aws-maven-plugin
Deploys resources to AWS using maven
Stars: ✭ 25 (-16.67%)
Mutual labels:  cloudformation

npm version

serverless-cognito-add-custom-attributes

This plugin allows you to add custom attributes to an existing CloudFormation-managed Cognito User Pool from serverless without losing all your users. At the time of writing (June 2018) CloudFormation doesn't know how to add custom attributes to a user pool without dropping and re-creating it, thus losing all your users.

This plugin also adds the specified attributes to a User Pool Client, giving that client read and write permissions for the new attribute.

Requirements

  • Node 8+
  • serverless 1+

Usage

Install npm i serverless-cognito-add-custom-attributes, then add serverless-cognito-add-custom-attributes to your serverless.yml plugins list.

plugins:
    - serverless-cognito-add-custom-attributes

custom:
  CognitoAddCustomAttributes: 
    CognitoUserPoolIdOutputKey: "CognitoUserPoolApplicationUserPoolId"              # The key of the outputted UserPool Ref 
    CognitoUserPoolClientIdOutputKey: "CognitoUserPoolApplicationUserPoolClientId"  # The key of the outputted UserPoolClient Ref
    CustomAttributes: 
      - 
        AttributeDataType: String
        DeveloperOnlyAttribute: False
        Mutable: True
        Name: "another" # this will end up being custom:another
        Required: False

# Only add this if not already outputting the Cognito User Pool and Client IDs, otherwise, refer to the existing outputs in the custom:CognitoAddCustomAttributes section
resources:
  Outputs:
    CognitoUserPoolApplicationUserPoolId:
      Value:
        Ref: CognitoUserPoolApplicationUserPool
    CognitoUserPoolApplicationUserPoolClientId:
      Value:
        Ref: CognitoUserPoolApplicationUserPoolClient

Details

  1. Output your UserPoolId via resources.Outputs
  2. Output your UserPoolClientId via resources.Outputs
  3. Add CognitoAddCustomAttributes to custom with the following structure:
  CognitoUserPoolIdOutputKey: "UserPool Output Key as a String"
  CognitoUserPoolClientIdOutputKey: "UserPoolClient Output Key as a String"
  CustomAttributes:
    -
        AttributeDataType: String
        DeveloperOnlyAttribute: False
        Mutable: True
        Name: "another"
        Required: False

Note: If you have multiple userPool-userPoolClients you can specify them as an array as well

Example:

plugins:
    - serverless-cognito-add-custom-attributes

custom:
  CognitoAddCustomAttributes:
    -
      CognitoUserPoolIdOutputKey: "CognitoUserPoolApplicationUserPoolId"
      CognitoUserPoolClientIdOutputKey: "CognitoUserPoolApplicationUserPoolClientId"
      CustomAttributes:
        -
          AttributeDataType: String
          DeveloperOnlyAttribute: False
          Mutable: True
          Name: "another" # this will end up being custom:another
          Required: False
    -
      CognitoUserPoolIdOutputKey: "CognitoUserPoolApplicationUserPoolId"
      CognitoUserPoolClientIdOutputKey: "CognitoUserPoolApplicationUserPoolClientId2"
      CustomAttributes:
        -
          AttributeDataType: String
          DeveloperOnlyAttribute: False
          Mutable: True
          Name: "another" # this will end up being custom:another
          Required: False

resources:
  Outputs:
    CognitoUserPoolApplicationUserPoolId:
      Value:
        Ref: CognitoUserPoolApplicationUserPool
    CognitoUserPoolApplicationUserPoolClientId:
      Value:
        Ref: CognitoUserPoolApplicationUserPoolClient
    CognitoUserPoolApplicationUserPoolClientId2:
      Value:
        Ref: CognitoUserPoolApplicationUserPoolClient2

The names of your attributes supplied here will appear as custom:{name} when deployed.

For more information on the schema of attributes see: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_SchemaAttributeType.html

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].