23,99 €
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#.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 125
Veröffentlichungsjahr: 2018
Copyright © 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor:Wilson D'souzaAcquisition Editor: Reshma RamanContent Development Editor: Roshan KumarTechnical Editor: Shweta JadhavCopy Editor: Safis EditingProject Coordinator: Hardik BhindeProofreader: Safis EditingIndexer:Aishwarya GangawaneGraphics: Jisha ChirayilProduction Coordinator: Deepika Naik
First published: June 2018
Production reference: 1290618
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-78934-019-8
www.packtpub.com
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and, as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Markus Klems is a software development and system administration expert for scalable, high-availability, and high-performance software systems, such as big data, mobile, web application, and Software-as-a-Service systems. Within the framework of his research and development work at TU Berlin and Karlsruhe Institute of Technology (KIT), Markus has gained in-depth knowledge and experience of complex and large-scale IT systems. He has been working with Amazon Web Services (AWS) since 2008 and is particularly excited about serverless computing and serverless microservice architectures.
If you're interested in becoming an author for Packt, please visitauthors.packtpub.comand apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Title Page
Copyright and Credits
AWS Lambda Quick Start Guide
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the author
Packt is searching for authors like you
Preface
What this book covers
What you need for this book
Who this book is for
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Bibliography
Getting Started with AWS
Installation and setup guide
Installing the Serverless framework
Introduction to AWS
Cloud service pricing
Pricing example
AWS Management Console
Regions
AWS Lambda
AWS API Gateway
Summary
Exploring the Serverless Framework
The Serverless framework
Creating a serverless project
Programming a Lambda function with Node.js
Testing and debugging Lambda functions
Testing the API using Postman
Testing and debugging via the AWS Management Console
Summary
Building a Serverless Application
Building a stateless serverless web application backend
Changing the file structure
Creating more functions
Creating a stateful serverless backend with DynamoDB
Creating a web client
Deploying a serverless frontend on CloudFront
Summary
Programming AWS Lambda with Java
Deploying and Testing AWS Lambda Functions
Lambda Function with S3 Event Input
Creating a Simple Serverless Java Project
Summary
Programming AWS Lambda with Python
Creating a python lambda function
Using the Serverless Framework with Python
Building a Serverless backend with Python
Summary
Programming AWS Lambda with C#
Creating C# Lambda functions with .NETCore
Creating an AWS Lambda project
Creating C# Serverless Project with .NET Core
Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think
Welcome to Learning AWS Lambda!
In this book, you will learn how to use Lambda, how to use it in combination with other AWS services, in particular API Gateway Service, but also services such as DynamoDB, which is the database as a service offering by Amazon that is also a pay-per-use utility-based, utility computing-based service, which works very well in the context of our serverless application architecture.
Also, we will look at other Amazon Web Services that work well alongside Lambda. In addition, you will learn how to use the serverless framework to build larger applications to structure your code, to autogenerate boilerplate code that you can use to get started quickly. In this video, we will explore Lambda and you will learn how to build scalable and cost-efficient applications that require nearly no operations once you have built and deployed your application.
So let's get started on this wonderful journey.
Chapter 1, Getting Started with AWS, gives you an introduction to the fundamental concepts of AWS and also explores the AWS web dashboard. You will also learn to create and test your first lambda function as well.
Chapter 2, Exploring the Serverless Framework, teaches you how to use the Serverless Framework to create and test Lambda functions and APIs. You will also try out different approaches for API testing, Lambda testing, and debugging.
Chapter 3,Building a Serverless Application, shows you how to build your first serverless application.
Chapter 4, Programming AWS Lambda with Java, focuses on how to program Lambda using Java. You will also learn how to use Eclipse with the AWS Toolkit plugin.
Chapter 5, Programming AWS Lambda with Python, features how to create Lambda functions from blueprints on the AWS Management Console using Python.
Chapter 6, Programming AWS Lambda with C#, showcases how to create C# Lambda functions and serverless projects with NET Core.
The only prerequisite for this course is to have basic programming or scripting experience, which will facilitate the understanding of the examples quickly.
In terms of environment, you only need to download the virtual machine that contains the vulnerable target web application and the Python environment with all the necessary libraries. To run a virtual machine, you will need to install VirtualBox from www.virtualbox.org.
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.
This book will give you the maximum benefit if you have some theoretical knowledge of AWS services. Additionally, install the following in your system:
Java version 1.8
Visual Studio 2015
Python 2.7.15
You can download the example code files for this book from your account atwww.packtpub.com. If you purchased this book elsewhere, you can visitwww.packtpub.com/supportand register to have the files emailed directly to you.
You can download the code files by following these steps:
Log in or register at
www.packtpub.com
.
Select the
SUPPORT
tab.
Click on
Code Downloads & Errata
.
Enter the name of the book in the
Search
box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR/7-Zip for Windows
Zipeg/iZip/UnRarX for Mac
7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub athttps://github.com/PacktPublishing/AWS-Lambda-Quick-Start-Guide. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available athttps://github.com/PacktPublishing/. Check them out!
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here:https://www.packtpub.com/sites/default/files/downloads/AWSLambdaQuickStartGuide_ColorImages.pdf.
There are a number of text conventions used throughout this book.
CodeInText:Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles.Here is an example:"Mount the downloadedWebStorm-10*.dmgdisk image file as another disk in your system."
A block of code is set as follows:
service: blogprovider: name: aws runtime: nodejs4.3 stage: dev region: eu-central-1
Any command-line input or output is written as follows:
sls create -t aws-nodejs -n blog
Bold: Indicates a new term, an important word, or words that you see on screen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Select System info from the Administration panel."
Feedback from our readers is always welcome.
General feedback: [email protected] mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us [email protected].
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visitwww.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us [email protected] a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visitauthors.packtpub.com.
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packtpub.com.
The material in this book has been selected from the content of Packt's video Learning AWS Lambda by Markus Klems to provide a specific focus on learning to build and deploy serverless apps on AWS.
Amazon Web Services (AWS) is a collection of web services that together make up a cloud computing platform that can help make an organization more efficient. It offers a broad set of global computing, storage, database, analytic, application, and deployment services. AWS is very beneficial as it is highly flexible and very easy to use. It is also very cost-effective and reliable, with high performance and scalability.
In this chapter, we are going to take a look at fundamental AWS concepts, such as cloud service usage and pricing models. We will explore the AWS web dashboard, the so-called Management Console. On the Management Console, we will take our first steps with Lambda and the API Gateway Service.
Now, we are going to have a look at the following topics:
Introduction to the fundamental concepts of AWS
AWS account walkthrough
AWS Lambda
AWS API Gateway
Before going any further into how to use AWS, let's first create and set up an AWS account. This is a prerequisite for getting started with programming AWS Lambda. Here, I'm going to show you how to sign up for an AWS account and then I will show you how to create a special IAM user with administrator access permissions. After that, I'll show you how to set up a local development environment with AWS credentials. So let's dive in:
First, open the web browser on the main website of Amazon Web Services,
https://aws.amazon.com/
Click on the
Create an AWS Account
button to create a new AWS account
Select the
I am a new user
radio button and enter your email address
Then, fill out the rest of the information and go through the sign-up process:
Once the account has been created, sign in to the AWS Management Console. More information on the console will be provided later on. For now, click Services in the drop-down menu and search for IAM. Click on IAM to navigate to the Identity and Access Management dashboard. Here, I am going to show you how to create a special IAM user that has certain permissions to use AWS services on my behalf. This is a good security practice. You shouldn't use your root account credentials for programmatically accessing Amazon Web Services. It could create problems for you—for example, you could accidentally publish your AWS credentials on GitHub or somewhere else where other people can see them, and using these details, they could then use your AWS services. If this happens to you, it's pretty easy to use IAM to simply delete your user and revoke these permissions:
In this tutorial, I'm going to create a group and an IAM user to perform the exercises. After we are done with the tutorial, you can simply delete the user and the group.
Let's start by creating an IAM group. Set up a group name. For this tutorial, I am naming the group learninggroup