Automation as a Service

Nowadays, there are services, such as AWS CloudFormation or Terraform, which automate a significant amount of the configuration that's required for provisioning and running applications and infrastructure. Often, there is a requirement for some tasks to be performed that have the potential to be automated but are completely bespoke and not supported by the tools we mentioned earlier. This is where serverless really shines. Through the use of functions as a service (FaaS) tools such as AWS Lambda, you can convert your existing automation script into something generic and host it independently.

Let's take the original example of a Java application deployed on a Linux server and a .NET application on a Windows server. Here, you'd be able to write a generic script in any language (see the Further reading section for details about using your own runtime) and host it on a lambda function. Instead of using a specific DSL, we're now using the languages that we're already comfortable with. Then, the function can be triggered by any kind of event; for example, a successful deployment of an application triggers the initialization script, which reaches out to the hosted application.

Not only do these benefits apply to monolith-style applications, but also using serverless technologies and patterns for automation is almost a necessity when building, deploying, and managing serverless applications. Automating through the use of serverless technologies also enables a wider range of capability for more efficient automation. The efficiencies can be gained through making the automation event-driven. You no longer need a script on a weekly schedule to tidy up a server's logs; instead, you could fire an event when logs get to a certain size. By doing this, this event could trigger a Lambda with a script on it that truncates the logs.

The evolutionary part of automating or modernizing with serverless is that you can perform actions in the ecosystem that surround the server itself. You can automate every part of the server's life cycle and respond to changes in health or utilization. A great example of this is using EC2 Auto Scaling groups, where a pool of application servers can be horizontally scaled automatically, based on a metric threshold. The complete life cycle can be automated—terminating an unhealthy instance, deploying a new server, sourcing the application code, bootstrapping the runtime, setting up the load balancer, and monitoring.

That concludes this section. In Chapter 7, Serverless Framework, we will introduce a framework that you can use to maintain, develop, and deploy your automation projects.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.239.118