Prefaces
A decade ago, cloud servers abstracted away physical servers paving the way for more technological advancements. Serverless computing is a cloud-computing execution model in which the cloud provider acts as the server, dynamically managing the allocation of machine resources. Serverless Computing abstracts the underlying servers and is considered as a form of utility computing.
The name "serverless computing" is used because the server management and capacity planning decisions are completely hidden from the developer or operator. A serverless code can be used in conjunction with code deployed in traditional styles, such as microservices.
In general, there are two types of automated operations:
- Scheduled script tasks, which executes based on a particular schedule such as regularly changing access key secret for cloud services, periodically checking the ports exposed by ECS etc.
- Event Driven Scripts which does the emergency handling of alarm events, such as an abnormal restart of an ECS instance.
Traditionally, the processing of the Scheduled tasks are usually implemented using a crontab script, but as the number of managed servers increase, the scripts will have to be centrally managed. At this point, the availability of the scattered machines that centrally manage the script, relevant information such as plaintext password and records of scheduled task execution are a big challenge. As for event-driven alarm processing, either a standard message notification service like SMS or a custom-built service is required to process the alarm information.
Either way, both the financial cost and operation cost are substantial. This article explores a new method of operation by using function compute to perform an automated process, providing an highly reliable and high-quality operation and service at an extremely low cost.
Function Compute
Alibaba Cloud Function Compute is an event-driven and fully-managed compute service that allows developers to run code without provisioning servers and could form a crucial missing piece of the DevOps equation. With Function Compute, you can quickly build any type of applications or services without considering management or O&M. You can complete a set of backend services for processing multimedia data in a few minutes without having to manage the underlying infrastructure thereby concentrating on the business logic. It's as simple as writing code to respond to an event and upload it to Function Compute. The function Compute will prepare the computing resources for you to run your code elastically and reliably, as follows:
- No infrastructure - No need to purchase and manage servers
- Flexible Pricing - Pay-as-you-go, for example, for low-frequency operation calls there can be financial costs savings of more than 90%.
- Focus on Business - Focusing on the development of business logic can greatly improve development efficiency, such as Deploy a flexible and highly available image processing service within 10 minutes.
- Stable and Reliable - Stable , Highly availability, millisecond-level elastic scaling to cope up with peak demand pressure.
- Traceable - Provide log query, performance monitoring, alarm and other functions to quickly troubleshoot.
Function Compute meets automated operation
Function Compute gives the users great freedom through implementing the custom function. Once it meets the custom automation operation, it will knock spark. The following article makes a comparison between the traditional automated operation and Function Compute for automated operation in two different types of dimensions:
Scheduled Task Example
Scheduled Task Example 1
Some cloud service accounts access key secrets need to be replaced periodically to ensure access key security
Scheduled Task Example 2
Regularly check your ECS for the exposed ports to ensure safety. For example, if your ECS is a web server, you may only need expose port 80 externally. If there is a vulnerability of 0.0.0.0./0 that allows everyone to access, an alarm or automated repair is required.
Function Compute for automated operation sample 1 - timed task
Event-riven example
Event-driven example 1
Assume that there are two ECS machines A and B, and machine A goes down. At this time, the EIP on machine A needs to be migrated to the standby machine B. The cloud monitoring alarm, and Function Compute can be used to realize the automatic migration of epi by cloud monitoring. The event of A downtime is detected, and then the function execution is triggered and implements automatic migration of EIP.
Function Compute for automated operation sample 2 - event triggered epic automatic transfer
Event-driven example 2
Assuming that an ECS had a system error and restarts, the users may urgently need to do some verification or create a snapshot. In the following actual sample, A machine that restarts due to a system error instance or restarts due to an instance error, we are going to automatically respond by creating a snapshot process after a successful restart.
Summary
By Using a Function Compute for automated operations, you have acccess to a computing environment which is flexible, highly available, highly secure that is visually monitored and managed. At the same time, Cloud monitoring provides rich events, and events are getting richer(Cloud product system event monitoring). Rich events that can trigger custom functions and high-availability timers can make automated operations much more perfect.
If you are interested in the topic of Automated operation of Function Compute
, please click to bookmark this page, we will continue to update the relevant content and actual cases on the topic of automated operation.