This week has been heavy on AWS architecture, I’ve spent a lot of time thinking through serverless implementations.
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 (this is normally done with a .htaccess file for traditional servers)
- Store data in an S3 bucket using a Lambda function
- Use a Lambda function to trigger a Code Pipeline and then deploy an app to an S3 bucket (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 (index files within subdirectores are not recognised)
- How to redirect www subdomain to the root domain (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! 😀