Resources Example Project
This project demonstrates creating AWS resources in an Osiris project and using them from the code that handles HTTP requests.
An SQS message queue is created in the file
root.template in the resource
LambdaPolicy block has been extended to add permissions for the queue. The policy grants the generated lambda permissions to send, receive and delete messages on the queue.
The URL of the SQS queue is passed to the template generated by Osiris. The generated template is referenced by the
ApiStack block. It has a parameter
QueueUrl which is a reference to the queue.
An environment variable named
QueueUrl is created containing the URL. Any parameters to the resource referencing the generated template are automatically exposed to the code as environment variables.
ResourcesExampleComponents reads the
QueueUrl environment variable and exposes it as a property that is used by the handler code.