Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
AWS Lambda Quick Start Guide
AWS Lambda Quick Start Guide

AWS Lambda Quick Start Guide: Learn how to build and deploy serverless applications on AWS

eBook
€13.98 €19.99
Paperback
€24.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

AWS Lambda Quick Start Guide

Exploring the Serverless Framework

In the previous chapter, we learned how to use the AWS Management Console to create Lambda functions and APIs. Now, we will use the Serverless framework to programmatically create APIs and Lambda functions. We will use the serverless command-line interface to deploy and test our functions. This will tremendously speed up our development processes.

The term serverless generally refers to applications that make heavy use of third-party cloud services, such as AWS Lambda. These services are also sometimes referred to as cloud functions, serverless microservices, or serverless functions. This doesn't mean that there are no servers involved anymore, just that you haven't installed to manage and operate these servers yourself. This is handled by the cloud provider, who takes care of things like scalability, high availability, security, performance...

The Serverless framework

Here, we are going to take a look at the Serverless framework documentation. We will then take a look at how to install it, and then we'll try out our first commands.

Go to the main landing page of the Serverless framework, serverless.com.

To find all the information that you need, click on Quick Start Docs. For now, let's take a quick look at the installation section. The first thing that you need to have installed is Node.js, and you will find some information on how to install it on your local machine. For programming serverless, we need Node.js version 4 or higher. If you don't have Node.js already, please do so now, and then resume.

Serverless runs on Node 4 or higher. For installing, go to the official Node.js website, download, and follow the installation instructions. If you want to see if Node has been installed successfully, just...

Creating a serverless project

In the previous section, we installed the Serverless framework and tried out the command line. Now, let's create our first serverless project. We are going to use the Serverless framework to create a simple Node.js lambda function and a REST API. Open Terminal and create a directory where you can place your serverless project files. I named it app, but you can name it whatever you want. Go to that directory and open your preferred IDE. I used the Atom editor. When the Atom editor was opened in my empty directory, I used an Atom package at terminal plus to open a new Terminal window inside my IDE. This makes it easier because I don't need to switch between writing code and typing in commands. So, let's type in a command to scaffold a serverless service:

serverless create --template aws-nodejs

The command for creating a service is created...

Programming a Lambda function with Node.js

Now, let's learn a little bit more about programming Lambda functions with Node.js. We are going to take a closer look at the function handler, and in particular its arguments, that is:

  • Event objects
  • Context objects
  • Callback objects

Open the handler.js file and delete the code that's in the function body. One way to learn about the event and context object would be to log them out on the console:

'use strict';
module.exports.hello = (event, context, callback) => {
console.log('event is', event);
};

Let's see what this gives us.

I am invoking the function locally to see what the output is with the function name set as hello:

sls invoke local -f hello
event is

Ok, my event, apparently, is null. Let's see what the context is, as shown next:

module.exports.hello = (event, context, callback) =&gt...

Testing and debugging Lambda functions

In the previous section, we learned about programming Lambda function handlers. Now, let's explore testing and debugging.

Here, we are going to look at three different testing and debugging approaches:

  • Using the Serverless framework
  • Using Postman for testing our API
  • Using the AWS Management Console

Let's go back to our handler.js file from the previous section. There are a couple things that should be changed. The response method should be changed back to something that our API can work with.

Give it a body property with a stringify JSON content, as shown here:

body: JSON.stringify({

And, in the JSON content, get back the event in the remaining time from the context, and then, instead of returning an error, we will return the response:

'use strict';
module.exports.hello = (event, context, callback) => {
let remainingTime...

Summary

In this chapter, we learned how to use the Serverless framework to create and test Lambda functions and APIs, and we tried out different approaches for API testing, Lambda testing, and debugging. Now, we have all the things necessary to build a real application, so in the next chapter, that's what we are going to do, by building a serverless application.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Learn to write, run, and deploy Lambda functions in the AWS cloud
  • Make the most of AWS Lambda functions to build scalable and cost-efficient systems
  • A practical guide to developing serverless services and applications in Node.js, Java, Python, and C#

Description

AWS Lambda is a part of AWS that lets you run your code without provisioning or managing servers. This enables you to deploy applications and backend services that operate with no upfront cost. This book gets you up to speed on how to build scalable systems and deploy serverless applications with AWS Lambda. The book starts with the fundamental concepts of AWS Lambda, and then teaches you how to combine your applications with other AWS services, such as AmazonAPI Gateway and DynamoDB. This book will also give a quick walk through on how to use the Serverless Framework to build larger applications that can structure code or autogenerate boilerplate code that can be used to get started quickly for increased productivity. Toward the end of the book, you will learn how to write, run, and test Lambda functions using Node.js, Java, Python, and C#.

Who is this book for?

This book is primarily for IT architects and developers who want to build scalable systems and deploy serverless applications with AWS Lambda. No prior knowledge of AWS is necessary.

What you will learn

  • • Understand the fundamental concepts of AWS Lambda
  • • Get to grips with the Serverless Framework and how to create a serverless project
  • • Testing and debugging Lambda functions
  • • Create a stateful, serverless backend with DynamoDB
  • • Program AWS Lambda with Java, Python, and C#
  • • Program a lambda function with Node.js

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 29, 2018
Length: 184 pages
Edition : 1st
Language : English
ISBN-13 : 9781789340600
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jun 29, 2018
Length: 184 pages
Edition : 1st
Language : English
ISBN-13 : 9781789340600
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 98.97
Mastering AWS Lambda
€36.99
AWS Certified Solutions Architect ??? Associate Guide
€36.99
AWS Lambda Quick Start Guide
€24.99
Total 98.97 Stars icon
Banner background image

Table of Contents

7 Chapters
Getting Started with AWS Chevron down icon Chevron up icon
Exploring the Serverless Framework Chevron down icon Chevron up icon
Building a Serverless Application Chevron down icon Chevron up icon
Programming AWS Lambda with Java Chevron down icon Chevron up icon
Programming AWS Lambda with Python Chevron down icon Chevron up icon
Programming AWS Lambda with C# Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Alain Apr 25, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Very useful resource, practical, well written, hands-on
Subscriber review Packt
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.