Shared Resources Extensions

To create your own Shared Resource Extensions, you define a module with the methods in the app/shared/extensions folder. Here’s a simple example:


module SqsExtension
  def sqs_queue(logical_id, props={})
    defaults = { message_retention_period: 120 }
    props = defaults.merge(props)
    resource(logical_id, "AWS::SQS::Queue", props)

After the module is defined, you can use the method in your Shared Resource like so:


class List < Jets::Stack
  sqs_queue(:fastpass, receive_message_wait_time_seconds: 20)

The code above creates an SQS Queue with a message_retention_period of 120 seconds and a receive_message_wait_time_seconds of 20 seconds. By creating your own resource extensions you can shorten your code and remove duplication.

Note: The sqs_queue is an example and is actually already implemented by Jets. We’re using it for demonstrative purposes.

Pro tip: Use the <- and -> arrow keys to move back and forward.

Edit this page

See a typo or an error? You can improve this page. This website is available on GitHub and contributions are encouraged and welcomed. We love pull requests from you!