The course is part of this learning path
This course touches on the similarities and differences between AWS, GCP, and Azure serverless functions. The idea is to give you insight into what using the different offerings look like. The primary learning objective is to help you make an informed decision about which provider to use and if it fits your use case. The 30-minute course covers the three different providers (content largely taken from the comparing cloud platforms course--but cut down for content), deploying a sample application on each, and the ecosystem around deploying serverless applications. The provider lesson uses the same application and demonstrate deploying and other operational characteristics of each provider.
- IT Pros
If you are not already familiar with serverless start with "Getting Started with Serverless Computing” before continuing with this course. You’ll also need some experience with cloud providers as well. Nothing specific is required, though you should have a general idea of how cloud computing works.
- Understand the state of serverless in 2017 List trade-offs between AWS, Google, and Microsoft platforms
- Learn to build, deploy, and run applications on the three platforms
- Learn open source tools for building serverless applications
This Course Includes
30 minutes of high-definition video.
What You'll Learn
Course Intro: What to expect from this course.
Serverless Overview: In this lesson, we’ll introduce you to the key players and prepare you for the hands-on demos in the following lessons.
AWS Lambda: In this lesson, you’ll learn about serverless on Lambda and deploy a Lambda function.
Azure Functions: In this lesson, we’ll discuss serverless Azure functions and learn how to deploy an HTTP function.
Google Cloud Functions: In this lesson, you’ll learn about serverless on Google Cloud and deploy an HTTP trigger function.
Ecosystems and Tools: In this lesson, you’ll learn about serverless framework and Apex.
Conclusion: A summary and review of what you have learned.
Hello, and welcome back to the Serverless Survey course. I'm Adam Hawkins, and I'm your instructor for this lesson. This lesson covers Amazon Lambda. Our objective for this lesson is to deploy an HTTP Lambda function and work with logging and monitoring. Let's jump in. Here we are in the AWS console.
We'll create a Hello World Lambda function. AWS provides a new function wizard, which creates examples from blueprints. We'll start off with a blank function, then select the triggers. AWS supports triggers from HTTP requests via API Gateway, in S3, and many more. We'll go with the API Gateway for now. The wizard creates an AWS API Gateway, mappers from HTTP request to Lambda arguments, and a mapper from Lambda results to HTTP responses. Also, select Open Authentication for an easier demo. Then we're ready for the next step. I've pasted in a function that sends 200 OK with a Hello World body.
Now onto the configuration options. You can set environment variables for database connection strings, secrets like API keys, or locations of other services. Environment variables may be changed to outside the source so you can change configuration without changing function code, but we'll skip that for now. Now set the handler. This should match the exported function in the source code. Lastly, you'll need to configure the IEM role for this function.
The rule declares what AWS API calls a Lambda function can make. Select New Rule from template and provide a name. AWS will add all the required rules for you. You don't need to fill in extra templates. Finally, confirm and create the function. Now, we're looking at the AWS Lambda console. A Lambda function is currently selected. You'll see the web gateway URL, actions, and a big blue Test button. Tests provide a playground for interacting with the Lambda function. We can quickly test a function with some dummy data and see if it's working.
We can also try out the publicly accessible URL. Just open it up in your browser. You should see Hello World. Looks like it's working fine. Now, bear in mind that there's a lot of AWS machinery involved here. We have not touched the surface on handling different HTTP methods or what else you can do with the API Gateway. That could be an entire course on its own. So, now let's focus on some of the other day to day Lambda use cases. Let's update the function to print some debugging logs. You can use the inline code editor to update the code. This creates a new revision of Lambda, which you'll see shortly. We'll update the Lambda code to log the request itself. Save the Lambda and hit the URL again.
Now come back to the Monitoring tab in the AWS console. You'll see essential metrics like invocation count and latencies. Note this information is also available in the CloudWatch console. Hit the Logs link. You'll see multiple log streams. Each change to the Lambda generates a new log stream, so keep that in mind. The most recent stream works here. You can also click and expand a line to see full detaiLs or use filtering to look for specific messages.
Now, there's so much more you can do with Lambda than just this, so let's discuss and cover some other Lambda concepts before moving on. Lambda supports many different runtimes, such as Python and Java. Naturally, this changes the implementation of your function and how you respond to the triggers. Lambda functions may be triggered in many ways. We demoed HTTP via the API Gateway. Functions may be triggered by SNS topics for event driven applications, changes to DynamoDB tables, or one of my personal favorites, scheduled events for Serverless cron. Lambda functions shine at wiring up different AWS services.
That however requires strong knowledge about AWS access policies to authorize the different components, so expect that in the real world. Lambda also provides versioning and aliasing features. These features are intended for handling use cases like a rollback or handling different environments like production or staging. This comes into play when building your dependent pipelines. Also note that you can deploy via the AWS CLI by providing a zip file or an object in an S3 bucket. Finally, Lambda may be integrated with X-Ray for built in distributed request tracing. That's a big win for microservice applications. That's a wrap for Lambda. The next lesson comes from Microsoft Azure. See you there.
Adam is backend/service engineer turned deployment and infrastructure engineer. His passion is building rock solid services and equally powerful deployment pipelines. He has been working with Docker for years and leads the SRE team at Saltside. Outside of work he's a traveller, beach bum, and trance addict.