Cross-Stack References in Serverless

Link to chapter - https://serverless-stack.com/chapters/cross-stack-references-in-serverless.html

Hi! I’m about to split my mono-service to Cross-Stack Multi services and I have a reference to Cognito like this;

contact-creation:
    handler: contacts.creation
    environment:
      USER_POOL:
        Ref: ContactsCognitoUserPool
    events:
      - http:
          method: post
          path: contact
          cors:
            origins: ${self:custom.cors.${self:custom.stage}

How can I specify a reference like this if the pool is not created yet?

You can see an example of this here - https://serverless-stack.com/chapters/configure-cognito-identity-pool-in-serverless.html. We refer to a User Pool that was previously created.

Hi @jayair ! This chapter mentions that “Cross-stack references only apply within a single region. Meaning that an exported value can be referenced by any service in that region”.

What if in the future I wanted to use an AWS service that is not available in the same region of the rest of my stack? What is the best approach one could take?

can a complete example on this page please be provided. Its quite hard to follow what is referencing what as it seems the “examples” are just pasted from different applications referring to things not present in the rest of the example

The main guide used cross-stack references. We talk about it in this chapter here:

Hi! Which should be the best practise if I need the dynamo arn and name? I need the arn to give permission to lambda and the name for the enviroment of the other stack. Should I export both?

Yeah you could. Or for the name you can assume the scheme for naming the table and use that without the export.