-
Almost all of the examples in this book use the Serverless Framework to manage AWS resources and Lambda functions. Installation instructions for the Serverless Framework can be found at https://serverless.com/framework/docs/getting-started/.
-
In addition to the Serverless Framework, readers will need to have an AWS account to run the examples. For those new to AWS, you can create a new account, which comes with a year of usage in their Free Tier, at https://aws.amazon.com.
During the course of this book, you will need the following tools:
- AWS Lambda
- AWS RDS
- AWS API Gateway
- AWS DynamoDB
- AWS S3
- AWS SQS
- AWS Rekognition
- AWS Kinesis
- AWS SNS
We will learn how to use these tools through the course of this book.
To get the most out of this book
Download the example code files
You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and 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 at https://github.com/PacktPublishing/Serverless-Design-Patterns-and-Best-Practices. 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 at https://github.com/PacktPublishing/. Check them out!
Conventions used
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: "To test this, we need to set the timeout of the divide function to 4 seconds and put a time.sleep(3) in the middle of the application code."
A block of code is set as follows:
def divide(event, context):
params = event.get('queryStringParameters') or {}
numerator = int(params.get('numerator', 10))
denominator = int(params.get('denominator', 2))
body = {
"message": "Results of %s / %s = %s" % (
numerator,
denominator,
numerator // denominator,
)
}
response = {
"statusCode": 200,
"body": json.dumps(body)
}
return response
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
from raven_python_lambda import RavenLambdaWrapper
@RavenLambdaWrapper()
from raven_python_lambda import RavenLambdaWrapper
@RavenLambdaWrapper()
def divide(event, context):
# Code
Any command-line input or output is written as follows:
$ curl "https://5gj9zthyv1.execute-api.us-west-2.amazonaws.com/dev?numerator=12&denominator=3"
{"message": "Results of 12 / 3 = 4"}
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "The following screenshot shows Invocation errors from the AWS Lambda monitoring page for the divide function:"