LazyStack

AwsResources Directive

Use the AwsResources directive to create new resources or override selected properties of LazyStack default resources. LazyStack provides useful default resource definitions for your application stack but your requirements may demand different resource definitions. The AwsResources directive allows you to define resources directly in the LazyStack.yaml file. These resource definitions must conform to the AWS resource definition requirements.


AwsResources:
  PetStoreS3:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: 
        FnSub: ${AWS::StackName}-S3-${AWS::AccountId}
  Pet:
    Type: AWS::Serverless::Function
    Properties:
      MemorySize: 512

In the example above, an S3 bucket is defined for the application. You can define any AWS resources supported by CloudFormation in the LazyStack.yaml. However, it is more often the case that you will want to define a number of AWS resources in a separate CloudFormation template and then merge that template into the serverless.template using the AwsTemplate directive.

In the example above, we override the default MemorySize property on the Pet resource of type AWS::Serverless::Function.

The Pet resource name is generated by LazyStack from the tag name provided. In this case the tag name results in a lambda function resource name “Pet”. Using the AwsResources directive, you may override any of the properties in the default lambda function resource definition used by LazyStack except these properties which are always supplied by LazyStack:

  • FunctionName - managed by LazyStack
  • CodeUri - managed by LazyStack
  • Handler - managed by LazyStack
  • Events - managed by LazyStack

Some common AWS::Serverless::Function properties you would typically override include:

  • MemorySize: 128 # default
  • Timeout: 30 # default
  • Tracing: Active # default