Evan Melioris
Evan Melioris

Reputation: 21

Access CDK resources within Lambda

I have created a simple cdk python application which deployed a lambda function and a dynamodb database. However, I am not sure how to access the table name/ table arn from my lambda function. I would like to retrieve the table name from the cdk stack. What imports are necessary and how would I call a dynamodb table name/arn?

Upvotes: 1

Views: 377

Answers (1)

Michael Robellard
Michael Robellard

Reputation: 2358

You would normally set those as environment variables in the lambda, using the environment option of the CDK function. So in your CDK you would set the environment variables for the the lambda and in the Python code you would read them as environment variables using os.environ.

Upvotes: 1

Related Questions