Thinking through serverless
Tags: lambda, aws, serverless, devops
Published: 2021-12-20 18:37:24

---
title: Thinking through serverless
published: true
date: 2020-05-03 19:30:36 UTC
tags: lambda,aws,serverless,devops
canonical_url: https://jamesmiller.blog/thinking-through-serverless-implementations/
cover_image: https://i1.wp.com/jamesmiller.blog/wp-content/uploads/2020/05/serverlessCool-Story.jpg
---

This week has been heavy on AWS architecture, I’ve spent a lot of time thinking through [serverless implementations](https://aws.amazon.com/serverless/).

**Serverless computing** **is a cloud architecture where the cloud provider (in this case AWS) runs the server and dynamically hosted resources.**

The core benefits of serverless are that resources:

- are more efficient as they are only executed when they are required to be active (as opposed to purchasing servers on a daily / monthly basis)
- usually are cheaper to run as you only pay when the resources are being used (instead of paying daily / monthly for servers)
- are completely scalable and will not become overloaded (unlike servers, which require load balancers and special configuration for auto scaling)
- can be cached globally and therefore are accessed faster
- tend to be more secure, as there isn’t a specific server that can be SSH’ed on to and hacked

The difficulties of serverless lie in:

- trying to figure out how much actual costs will amount to
- you have to commit to a cloud provider in order to effectively make use of this architecture (I personally do not see this as a negative, but some people prefer to be cloud agnostic)
- if the cloud provider was to ever up its prices or have a catastrophic fail of resources / data breach, then your application could be effected (incredibly unlikely, but has to be said)
- things that are often ‘a given’ in traditional server-based architectures, are more complex when implemented in serverless

Building on that last point, I’ve created a series of tidbits that address some of these key fiddly configurations:

- [How to add Authentication to an S3 bucket](https://jamesmiller.blog/add-authentication-to-s3-bucket/) (this is normally done with a .htaccess file for traditional servers)
- [Store data in an S3 bucket using a Lambda function](https://jamesmiller.blog/storing-data-in-s3-with-lambda/)
- [Use a Lambda function to trigger a Code Pipeline and then deploy an app to an S3 bucket](https://jamesmiller.blog/lambda-code-pipeline-s3-deployment/) (servers can generate dynamic content on the fly, however serverless architectures need to be configured so they can do the same)
- [How to resolve routing issues within Cloudfront with Lambda](https://jamesmiller.blog/lambda-routing-fix-for-cloudfront/) (index files within subdirectores are not recognised)
- [How to redirect www subdomain to the root domain](https://jamesmiller.blog/lambda-function-301-redirects/) (this is normally done in the c-record within Route53 for traditional servers, but doesn’t work for serverless)

Hopefully these resources are helpful to other people who are also thinking through serverless implementations – good luck! ![😀](https://s.w.org/images/core/emoji/13.1.0/72x72/1f600.png)