---
title: "Technology Series: Deploying Lambda Functions and Layers on AWS"
description: "Technology Series: Deploying Lambda Functions and Layers on AWS"
---

[CyberCube - Cyber Insurance Analytics ](https://insights.cybcube.com/en)

# [Technology Series: Deploying Lambda Functions and Layers on AWS](https://insights.cybcube.com/en/post_typeblogpostp1384)

 Written by [Emmanuel Thioux](https://insights.cybcube.com/en/author/emmanuel-thioux) | Mar 22, 2020 1:10:00 PM

In our last article, we talked about AWS SAM (Serverless Application Model) and how to run an end-to-end application locally.

We'll be using the same code that we used to create a lambda and a small layer and deploy it to AWS.

## Template File

Just like with SAM, we need a template file to deploy our Lambda function and its associated layer.

If we look at the layer definition, we can spot a couple of differences:

- RetentionPolicy: This is now set to Delete instead of Retain
- ContentUri: Instead of specifying the location of the code, we refer to a S3 bucket

We had to change the retention policy because otherwise, the layer would not get updated on AWS and the Lambda would end up re-using the existing version, which is not what we want if we made changes to the layer.

Also, we don't want to specify a particular layer version, because we just don't know what i will be. Instead we indicate that the layer's code is in a ZIP file that's stored on S3.

## Swagger Spec

Another difference is that while we had a smallish swagger spec in our original template, we now need a swagger spec that's in a separate file (because it's easier to read and because we can export it from AWS to begin with).

You can find our swagger.yaml [here](https://github.com/manu-ccube/Code/blob/dev/aws-deployment/swagger.yaml)

[View full post](https://insights.cybcube.com/en/post_typeblogpostp1384)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Emmanuel Thioux"
  },
  "dateModified" : "2024-07-09T12:48:36.920Z",
  "datePublished" : "2020-03-22T13:10:00Z",
  "headline" : "Technology Series: Deploying Lambda Functions and Layers on AWS",
  "image" : {
    "@type" : "ImageObject",
    "height" : 366,
    "url" : "https://cdn2.hubspot.net/hubfs/6965604/2019-11-26-20-14-16-655-5ddd8798989b6e085c960d35-1.png",
    "width" : 640
  },
  "mainEntityOfPage" : "https://insights.cybcube.com/en/post_typeblogpostp1384",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60,
      "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
      "width" : 60
    },
    "name" : "Blog"
  }
}
```