I have a SAM app that besides an api-gateway and lambda, also creates an SNS topic and publishes to it.
To publish to the topic I need the topic's ARN which consists of the account ID.
Is there a dynamic way (so I do not need to put it in an env var) to get that account ID?
To reiterate:
- I have a sam app with lambda and SNS.
- I deploy to the cloud, SNS is created in the cloud.
- Iinvoke the lambda, Which works, but only if I hard-code the account id where I deployed in step 1.
Is there a way around hard coding or defining an env-var for this?