Score:0

AWS Cloudformation template - user pool app client hosted ui login url?

mx flag

Is there a way to retrieve the login page url for a cognito user pool app client from the cloudformation template?

I currently have two projects: one for a spa webapp end one for the aws stack to host and serve it.
In terms of automation it would be perfect to have the spa project pipeline retrieving any necessary url from the aws stack via cli (e.g.: sam describe-stack or such) before assets compilation, no?

Score:0
gp flag
Tim

You can use CloudFormation Outputs and Import them into templates that need them.

The CloudFormation Cognito User Pool documentation has a return value "ProviderURL". You would do something like this at the bottom of your CloudFormation template that creates the User Pool.

Resources:
  UserPool:
    Type: AWS::Cognito::UserPool
    Properties: 
      UserPoolName: Example
      (etc)
  Outputs:
    UserPoolURL:
      Value: !GetAtt 'UserPool.ProviderURL'
      Export:
        Name: "UserPoolURL"

Then you would do something like this in the CloudFormation template that needs to reference the URL.

Resources:
  ResourceName:
    Type: AWS::Whatever
    Properties: 
      URL: !ImportValue UserPoolURL

The code might not be quite right as I haven't tested it, but I've done this many times over the years and it should be about right if not perfect.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.