- Building Serverless Architectures
- Cagatay Gurturk
- 601字
- 2021-07-02 19:04:44
Infrastructure as a Code
In the previous chapter, we looked at the basics of AWS Lambda, starting with creating an AWS account to develop our first micro function. However, our deployment process was pretty manual and obviously not production-ready. Based on the principle of "if you repeat a task three times, it's time to automate", it is time to automate this process in order to build a first-class deployment process that will automate and facilitate our workflow.
If you have ever used AWS Lambda in other languages, you might have heard about some frameworks such as Serverless, Apex, or Kappa. These are valuable open source tools with great features, and they used to be very essential for AWS Lambda development with features such as packaging the code, creation of API Gateway endpoints, and so on. If you are authoring Lambda functions in JavaScript or Python, it is recommended that you leverage one of these frameworks. However, in the Java platform, we have already been using strong build tools, such as Maven or Gradle. If you are a Java person, with Gradle, we get rid of the complication of the build process and packaging artifacts. After we compile our code to a single fat JAR file, the next step would be to create AWS Lambda functions using them and create the API Gateway resources and methods. Until a few months ago, the mentioned tools were the easiest way to create these cloud resources, but with the latest developments of AWS, we do not need these tools anymore: CloudFormation is the default offering from AWS that meets all the requirements. At the end of the day, just using Gradle and CloudFormation, we can create our handcrafted automated build mechanism for any Serverless application.
Some of my colleagues have been criticizing me because I am ignoring the open source frameworks and reinventing the wheel with a custom build mechanism. This is a pretty subjective topic, and everybody may have a different option. If we can develop our own build system easily, as we are going to see in this chapter, I do not see any benefit of depending on a third-party tool and inheriting their complexity and possible problems. For Java, I prefer pure Java solutions, and at the moment, I want to teach you how we can deploy to AWS without the aid of third-party tools. I believe that in this way, you are going to learn about the internals of AWS more deeply
In this chapter, we will meet with CloudFormation, the legendary tool of AWS that automates the cloud resources with JSON templates. CloudFormation will be one of the main tools we will use in this book, and it is maybe the most important AWS tool ever. I personally believe that.
In this journey, first, we will extend our build phase and add a functionality to our Gradle build script to upload compiled JAR files to AWS S3 storage. Once we have our artifacts in the cloud, the Gradle build script will install our handcrafted CloudFormation template to our AWS account. At the end of the chapter, we will have a single command to rule all. It will execute all the tests, build the artifacts, upload them to the cloud, and finally, deploy our application.
CloudFormation may seem a bit complicated in the beginning, but we will try to explain the concepts as clearly as possible and refer to the relevant documentation as much as possible.
We will cover the following topics in this chapter:
- Uploading the artifacts to cloud
- Infrastructure as code with CloudFormation
- Deploying our first Lambda with CloudFormation
- The Android Game Developer's Handbook
- Android 9 Development Cookbook(Third Edition)
- Web全棧工程師的自我修養
- R的極客理想:工具篇
- SAP BusinessObjects Dashboards 4.1 Cookbook
- 計算機應用基礎教程(Windows 7+Office 2010)
- C++從入門到精通(第6版)
- INSTANT Apache ServiceMix How-to
- Scrapy網絡爬蟲實戰
- 例說FPGA:可直接用于工程項目的第一手經驗
- Processing開發實戰
- 算法訓練營:海量圖解+競賽刷題(入門篇)
- 程序員的英語
- Django 2.0 入門與實踐
- Appcelerator Titanium Smartphone App Development Cookbook