Functions as a service allow us to decouple development and deployment efforts more easily using containers or Kubernetes. However, there are additional complexities that arise when using a serverless architecture. Amazon simplifies the security, storage, and aggression components with their other servers very well.
Let's take a look at how we can set up a Lambda tied to a CloudFront distribution that points to our WordPress container. We will build a Lambda function that inspects the header of the request and sends it depending upon the information contained in that header.
First let's create our CloudFront Lambda file as cloudfront_lambda.js:
'use strict';exports.handler = (event, context, callback) => { const request = event.Records[0].cf.request; ...