Deploy other AWS resources

Learn how to deploy other AWS resources by specifying them in the serverless.yml file. Whenever you deploy your app, Serverless will provision these resources through CloudFormation. It will also make sure that your application is always in a consistent state and will rollback changes if something goes wrong.

In this video I show you how to provision an S3 bucket and a DynamoDB table. This is the code snippet used in the video:

resources:
  Resources:
    uploadBucket:
      Type: AWS::S3::Bucket
      Properties:
        BucketName: ${self:service}-${self:provider.stage}-uploads

    userTable:
      Type: AWS::DynamoDB::Table
      Properties:
        TableName: ${self:service}-${self:provider.stage}-users
        AttributeDefinitions:
          - AttributeName: userId
            AttributeType: S
        KeySchema:
          - AttributeName: userId
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1

You can provision almost any resource on AWS this way. Want to deploy another resource that wasn't shown in this video? Luckily Amazon has a bunch of examples on it's website: AWS Resource Types Reference.

Useful resources

Like this video? Support me & subscribe to my channel: