- 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
- 基于粒計(jì)算模型的圖像處理
- 跟“龍哥”學(xué)C語(yǔ)言編程
- 從0到1:HTML+CSS快速上手
- Learning Selenium Testing Tools(Third Edition)
- Linux操作系統(tǒng)基礎(chǔ)案例教程
- The DevOps 2.5 Toolkit
- Java編程的邏輯
- 深度學(xué)習(xí):Java語(yǔ)言實(shí)現(xiàn)
- Go語(yǔ)言精進(jìn)之路:從新手到高手的編程思想、方法和技巧(2)
- C語(yǔ)言程序設(shè)計(jì)實(shí)訓(xùn)教程與水平考試指導(dǎo)
- 玩轉(zhuǎn).NET Micro Framework移植:基于STM32F10x處理器
- Building UIs with Wijmo
- 用Python動(dòng)手學(xué)統(tǒng)計(jì)學(xué)
- RESTful Web API Design with Node.js
- 3D Printing Designs:Design an SD Card Holder