How to reference Cognito or DynamoDB resources not deployed via YML

Hi there,

Our Cognito resource is configured manually and being accessed by multiple systems.

We’d like our serverless.yml to reference the existing Cognito resource without trying to deploy a new Cognito resource. Similarly for our DynamoDB.

We have separate Serverless.YML files for deploying and removing these resources.

I’ve tried simply specifying the ARNs in place of the:

Fn::GetAtt:
          - MyAppsUserPool
          - Arn

but this fails.

Has anyone else tried this or had success doing this?

…Martin

Serverless uses Cloudformation under the hood. I was able to accomplish your scenario using Cloudformation Outputs in my ‘parent’ yaml file, and then referencing the outputs in my ‘child’ yaml files that need them, with the variables tools listed here.


https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html
1 Like

Thanks @alexvdvalk. I’ll try that approach. Much appreciated.

If you deployed the dynamoDB with a stack (cloudformation template), the stack can output and export a global identifier which you can then user in your serverless configuration.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html