Reader small image

You're reading from  Hands-On Chatbot Development with Alexa Skills and Amazon Lex

Product typeBook
Published inSep 2018
Reading LevelBeginner
PublisherPackt
ISBN-139781788993487
Edition1st Edition
Languages
Concepts
Right arrow
Author (1)
Sam Williams
Sam Williams
author image
Sam Williams

Sam Williams qualified with an aerospace engineering master's degree, then became a self-taught software developer while holding down his first job. While traveling, he started to write articles about the tech he was learning about and accrued an audience of readers on Medium and freeCodeCamp.Currently, Sam works as a lead chatbot developer for the SmartAgent team at MissionLabs, building custom systems for large retailers. His role ensures that he is working with the newest chatbot technologies and is constantly pushing their capabilities.
Read more about Sam Williams

Right arrow

Getting Started with AWS and Amazon CLI

Amazon Web Services (AWS) is the collection of all the tools and services that Amazon provides for developers in the cloud. There is a huge range of services available, from a server hosting to machine learning, from game streaming to digital marketing. Each of these services has been designed to perform one thing really well, but the biggest benefit is how well each of the services works together.

In this chapter, we will create an AWS account and explore the AWS console. Once we've got our account set up we'll learn about Lambda functions, creating one of our own. This will start out as a very simple Lambda, but we'll increase the functionality as we go through the rest of this book.

The next section of this chapter will talk about the different ways in which we can edit Lambdas and the advantages and disadvantages of each...

Technical requirements

In this chapter, we'll be creating a few Lambdas as well as creating a build script.

All of the code can be found at http://bit.ly/chatbot-ch2.

Creating an account

To access all of these services you need to create a free AWS developer account. Go to aws.amazon.com and click Create a Free Account. To create an account you need to follow the sign-up process. The process is very thorough and requires you to enter payment details and receive an automated phone call. This process is to validate that you are a genuine user.

Once you've created your AWS account you can access all of the services through the Amazon Console (console.aws.amazon.com). There is a lot of useful information on the console page. Build a solution and Learn to build are tutorials and information on how to use some of the services.

Setting your region

For this book, you will need to set your...

Creating a Lambda

AWS Lambda functions are incredible! They’re functions that are hosted on AWS that can be triggered in many different ways. Lambda functions are serverless, which means that you don't need to run a server to use them. This makes it a lot quicker and easier to set up and use.

One of the best parts of AWS Lambdas is that you only pay for the time the Lambda function is running. Got something that only runs once an hour and only takes two seconds? You’ll only be charged for 48 seconds a day! That’s insane compared to running a 24/7 AWS EC2 server or your own private server.

Today, we’ll create a Lambda function and look at the three best ways to work with the code.

Once you’ve got your AWS account set up, there are a few ways to create a new Lambda function. We’re going to start by using the AWS Console.

...

Methods for working with Lambdas

One of the big advantages of Lambdas is that you can choose how you write and edit them. There are three main ways to do so:

  • Lambda Console
  • Cloud9
  • On your local machine

I’m going to cover all three and discuss the advantages and disadvantages of each of them.

Method 1 – Lambda Console

This is the way that we have just created our first Lambda function. In the Lambda Console, we have a basic editor. It’s based on the Cloud9 IDE and works well for simple Lambda functions.

The advantages:

  • It’s a good editor
  • You can access it from any computer through your AWS Console

The disadvantages:

  • It doesn’t seem to be very stable. Sometimes it doesn’t let you...

Creating the best local development environment

As we've already seen, there are some brilliant aspects of writing Lambdas locally, which is why we are going to use it throughout this book. We're going to choose an IDE and install NodeJS and NPM before setting up a folder structure for our Lambdas. Finally, we'll use the AWS CLI and Git to create awesome tools to get rid of the normal disadvantages of working locally.

Choosing an IDE

Which IDE you use is down to personal preference; there are a few great ones out there, including Atom, Komodo, and Brackets. If you already have a personal favorite then you can use that, but all of the examples will use Visual Studio Code (VS Code).

VS Code is an open source IDE...

Summary

In this chapter, we have learned about Amazon Web Services and created an account, giving us access to all of these services.

We created our first Lambda function using the Lambda Console, and advanced it to use multiple functions, template strings, and requiring in code from other files.

Next, we discussed the three main ways to create Lambdas, namely the Lambda Console, Cloud9, and using local development. We also looked at the advantages and disadvantages of each.

Finally, we used the AWS-CLI and Git to make our local development setup far more powerful. The build script that we used allows us to create and update Lambdas without ever having to go onto AWS.

In the next chapter, we will learn to build our first Alexa Skills using the Alexa Skills Kit.

Questions

  1. Name the three main ways to create and edit Lambda functions.
  2. What does AWS stand for?
  3. What are the two main limitations of a basic local development setup?
  4. What tools do we use to improve our local development setup?
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Hands-On Chatbot Development with Alexa Skills and Amazon Lex
Published in: Sep 2018Publisher: PacktISBN-13: 9781788993487
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Sam Williams

Sam Williams qualified with an aerospace engineering master's degree, then became a self-taught software developer while holding down his first job. While traveling, he started to write articles about the tech he was learning about and accrued an audience of readers on Medium and freeCodeCamp.Currently, Sam works as a lead chatbot developer for the SmartAgent team at MissionLabs, building custom systems for large retailers. His role ensures that he is working with the newest chatbot technologies and is constantly pushing their capabilities.
Read more about Sam Williams