...

/

Passing Resource References to Functions

Passing Resource References to Functions

In this lesson, you will learn how to let SAM configure the environment variables​ for your application.

We'll cover the following...

In order to complete the function, you’ll need to tell it which bucket to use (line 8 from the code in the previous lesson). Lambda functions don’t really know about SAM and CloudFormation resources, so the function can’t just ask for the UploadS3Bucket resource. SAM will create the bucket using a randomised name, and you need to tell the Lambda function about the actual value.

You definitely don’t want to hard code a bucket name in the function source, because then SAM can’t automatically manage buckets. You could ...