OK cloggers and welcome to this lecture this lecture we're going to build a very first Servilius Web
site with route 53 API gateway lambda and S-3.
Let's have a look at how it's going to work.
So we've got our user they want to go ahead and get the IP address to help me study AWOS poly dot com
which is the domain I'm about to register with route 53 route 53 will return that IP address to the
users web browser.
They then want to go ahead and actually get the web page from S-3.
So they're going to be able to navigate to that S3 bucket.
It's going to return a web page but the actual web page has static and dynamic content and they need
to get the dynamic content the dynamic content will simply be my name or your name and it will then
their browser will then send a GET request over to API gateway API Gateway will then send that for THAT
GET request on to Lambda Lambda will then respond.
And then we will send that uses name back to them.
So really really simple sites and it's going to use basically three or four different components or
API gateway route 53 S-3 and LAMDA.
So let's go ahead and get started and log into the AWOS code.
So the code for this is all in the resources section of the course.
Please download the code now and unzip it.
OK so I'm hit in the AWOS console.
Now when registering a domain name and using static web sites for in 3 you need to check two things
you need to check that the domain name is available.
You also need to check that the bucket name is available and the bucket name and the domain name have
to be the same.
So I'm going to register.
Help me Polly help me study AWOS Polly dot com.
The first thing I'm going to do is make sure that's available in S-3.
You check S-3 first because it's free to register bucket names with domain names.
It's not free.
So help me study AWOS Polly dot com and I'm going to create that in the Northern Virginia region and
I'm just going to go ahead and hit create and that is available so I've provided is available on route
53 This is all going to work.
So I'm just going to click in here and I'm going to go to properties and I'm going to enable static
web site hosting for this bucket.
So use this bucket to host a web site quick quickly just go over and have a look at our code.
So this is where I've unzip the code.
It's just indexed up hatred to him.
An adult male this python is what we're going to use for Olenda function.
So we're going to type in the heat index page to now and then.
ERA.
Hey Timo we're going to go ahead and hit save and that has now created our bucket.
Now I can't do anything yet because we do need to edit our code and the very next thing I need to do
what I can upload our code to S3 bucket yet because I'm going to need to put in my IP gateway and point
into that code at some point.
OK so that is now an S-3 static web site bucket.
The next thing we need to do is go to route 53 Safaga over two services and we scroll down the route
53 here on the network and content delivery.
And then what we're going to go ahead and do is you going to register this as a domain.
Help me study AWOS Polly and just check that that's available.
Hopefully it is.
And yes it is.
So you have to make sure that the bucket name is available and the domain name is available.
If they're different it's not going to work your bucket name always must be the same as the domain name.
And by that I just mean that this this top level you don't have to have the bucket name with dot com
but the top you know this this level here not top level but then the next level down so help me study
AWOS.
Polly I have to have that as the bucket name as well as the domain name is going to add that to my cart.
I'm just going to go ahead and register this.
Now it's going to cost me $12.
This is completely optional if you want to do this or not.
You can just use the S-3 you are old for the rest of this course if you don't want to spend the money.
So we go ahead and register soulis now just pause the video.
OK.
Now have a register.
Sometimes it says it can take up to three days to complete.
That really you in some very rare cases it takes that long.
Usually you should have it in about 10 or 15 minutes or sometimes even less.
So I posed the video and just updated it and my help me study AWOS.
Polly is now a registered so we figured out as three bucket as a web site.
We have gone in and configured route 53 or bought a domain name and we've made sure that our bucket
name is the exact same as our 53 domain name including the top level domain.
So help me study Polly dot com help me study AWOS Polly dot com.
Next thing we need to do is configure our lambda function.
So let's go over to services and we'll go into the Lamda which is under compute.
If you haven't had a lambda function before you're going to see this splash screen.
Just click on Create a lamb to function.
So we're going to be using this all from scratch for later on when we go and build our Cisco using the
service application repository.
So there's three ways of doing lambda functions although from scratch blueprints which are configured
templates as a starting point feel them to function.
So these are just lambda functions that are pre-configured and then we have the surplus application
repository.
And this is basically how information templates that build service applications automatically for you
so we're going to use some Alexa similis application repository skills later on or at least one.
And if you do are interested in learning more about Lexa development we do have a course on the cloud
platform where we teach you how to build three skills.
And again we use the service application repository for that as well.
So let's call this my Servilius Web site.
So that's going to be our function name going to be using Python 3.6.
If you haven't used lambda before we are going to have to create a new role and the role is essentially
just allowing lambda the permission to execute.
So we'll call this I'd like to call up my lambda row and we're just going to use a policy template on
the policy template you want is simple Microcircuits permission so this allows lambda to execute.
That's all it does.
So there we go we go ahead and hit to create function.
And that should now create our function and we should be ready to go.
OK so my function has now been created.
Now if we scroll down this is the this is what lambda looks like.
So we've got a configuration in here it's got out monitoring his out designer.
If we scroll down we'll be able to see a function code.
So here's our actual function.
This is an acquisition Amazon made which you used to be called Cloud 9 which is integral.
It's basically a cloud integrated development environment or ID so you can actually write your code
now directly into Lamda which is really really cool.
And what we're going to be doing is we're going to be changing this code here to our own code so all
we need to do is just go over to where you downloaded your code.
Ok so in the directory where I've unzipped my code heartly done that in the resources section I'm just
going to go ahead and open that up with my favorite note.
Yeah my favorite text editor which is text Wrangler on Windows I use Notepad plus plus and in here we've
got our functions so basically all you want to do is change the name.
My name at the moment is the body is Ron Klinenberg you want to change this to your name.
Once you've done that.
Copy it into your clipboard and go back over to Lamda.
And here we are back in the console.
I'm just going to delete all these lines and paste in my iron.
So make sure it is your name.
Go ahead and click up here and go save.
And that will now say our function.
We scroll all the way back up the top.
We're almost ready to go.
What we need to do is add in our triggers now triggers a really popular exam topics in both solutions
architect associate as well as developers so shit.
So triggers our API gateway A.W..
The elixirs skills kit the Elix a smart home cloud from cloud watch events cloud watch Lokes code commit
cognito Issing trigger dynamo D-B can a 6 3 and S and S.
Seriously you will probably get a question saying which of the following is not allowed to trigger.
It is worth trying to memorize memorize all this going into your exam.
So we going to add API gateway as a trigger.
It says in his configuration required if you scroll down you can see configure triggers says will set
up an API gateway endpoint will.
Which will trigger your integration and in here pick an existing API or create a new one.
We're going to create a new API.
The API name just enter it in here so I'm going to call my API my service web site.
Maybe my Servilius you know why not.
Web site.
And then the deployment stage this is going to be in production and then his says configure the security
mechanism for your API endpoint so you want it to have.
I am.
Do you want it to be open.
Or do you want it to be open.
But you have to supply an access key before you can use it.
I'm just going to make mine open and it gives you a warning here saying your API endpoint will be publicly
available and can be invoked by all users.
That's fine for this particular one.
You could if you wanted a little bit extra security to open with access.
But we're not going to keep this anyway we can delete this once we go on to the Poly lab anyway so just
go ahead and do open.
Go ahead and hit add.
That has now created our API.
Click up here and just say your function is going to you know save everything.
So we clicked this little button.
Yeah we're actually going to get the invite.
You are all you can try copying paste that into your browser but it's not going to work just yet.
So we need to go in and configure it.
What you can do is click on my service website and that is going to open up the API.
Gateway page and you can see our API gateway is in here.
So what we now need to do is go ahead and configure this first thing I want you to know.
A round the API gateway is this UI and I really like this because it actually helps you visualize exactly
what's going on.
So you've got your client which is a little user they're going to send a method request at the moment
it could be any.
But we want to make it only I get.
So we're going to send to get request.
This is then going to be basically proxied over to Lambda Lambda function and here we could click on
this and open up Pallam to function and then that lambda function is going to persist that request and
then do a response saying going to send that back to API gateway an API gateway is going to send a method
response back to our client which will hopefully be our name.
So what we want to do is we're going to change this over to a get request.
Let's just start by deleting this method.
It's going to go ahead and delete this and then I'm going to go and create a new method and the method
is going to be a get.
So these these are all our valid email methods so I'm going to make mine I get and click the little
tick and that's going to give us our set up so in here we've got the integration point new method.
So what do we want to connect this method to do we want it to be to allow him to function or to hate
SCDP do we want to give it a mock response.
Maybe this is a development you know API that we're testing.
Do we want another eight AWOS service do we want to link this into a BPC we're going to select lambda
functions and then we're going to use proxy integration.
So we're going to allow it to proxy this across to Lamda and here's your region if you actually type
in your function here.
And it's only going to be the functions that exist within that region.
So make sure you know the region in which Sholem to function exists.
So minds in USA one click on my service web site and I'm going to go ahead and hit save and this then
says you're about to give API guideway permission to invoke your lambda function.
And here is the A-R in about lambda functions.
The Amazon rou resource name are valid to function.
Can I go ahead and click OK.
And that has now set it all up so it will be almost ready to go.
And next thing we need to do is go ahead and deploy our API.
So let's click in here and go deploy deployment stage.
I'm going to deploy this into production and this deployment description will be my first prod deployment
something like that.
I'm going to go ahead and hit deploy and you see now that we're in stages.
So if you even need to get back to this screen go over to stages.
Click on prod and then click on get you have your invoke you aro.
So if we click on this we should hopefully be able to get our name and there we go.
It's.
It's API Gateway's triggering a lambda function and lambda function is responding with my name.
And you can see it there.
You click back and you want to get that you are ill again just click on stages and prod grab the Jaro
quickly show you what it looks like as well.
If we were to do a CO command in you know an easy to instance.
So here I am on an easy to instance I'm just going to koe and then that and then I'm going to output
it into something like my name dot TXI let's say.
So if we nano my name takes Tay There we go we can say it's my E.C to instance has code API gateway.
It has gotten my name and it is then save that to a text file.
So now that we've done all this way ready to upload or edit our code and then upload it to Estrace or
go to where you download a Joe code case from where I downloaded my code.
All we want to do is open up index page to mail with our favorite text editors text wrangler or had
postes plus.
And so we've opened it up.
All we need to do is change this line of code here from your API gateway link here and just paste in
your API gateway and hit save.
And quickly just go through what it is this code does so it's like DML.
We've got our heads here in our head.
We've got some javascript which has a function called my function then we've got the body in here we've
got a header which says hello.
And then it says the idea my demo powder's and then we've got a button and on click it's going to execute
this function and the button says Click Me and we're going to end a button.
So the function in here you can see the function.
Basically what we're going to do is a TDP request the HTP request is going to be a get request.
It's going to go to our API gateway Jaro.
And if it's successful so if the status is 200 then it's going to display the response.
And then we've got an image and you'll see what this image is at the end of the lecture.
It's one of my favorite photos in the whole wide world.
So let's go ahead and save this and go back over to the AWOS console.
So back in the console can it go over to services.
I'm going to go down to three which is under storage.
So down in case that has now opened up my S-3 you can see my S-3 Web site in here.
Help me study AWOS Polly dot com.
So go ahead and click on that.
It my files so let's add our files in here.
So it's era and indexed not hatred himself.
Can I go ahead and hit upload and then the very last thing we need to do is make these public so if
we just go and click on make public and make public that will now make our hatred himself public and
index start hated him how and how erudite hates him till the very last thing we need to do is we need
to go to route 53.
So we go down to networking route 53 route 53 and click on hosted zines and in here I've got my host
Zeins help me study A.W. I start poly and then going to create a record set and this record set is going
to be an alias record.
So it's just going to be the naked domain name.
So it's not going to have a W WW or anything like that.
So just click on Alias and then here you've got your target.
So if we click in here you should be able to see S-3 Web site in here.
If you can't if it says no targets available it means that your S-3 bucket name and your your route
53 a domain name are not the same and that does include the top level domain name as well.
You do definitely need that.
So go ahead and click in here and go ahead and hit create.
And that has now created my my area code and it's an alias and it's pointing back to my S-3 bucket's.
The next thing I need to do is just go over to help me study a pulley case I'm just going to type and
help me study.
Polly dot com and I'm going to go ahead and hit enter.
And there we go.
It says Hello cloud gurus and it says Click me will you click me.
That will then send a request off to API gateway which will trigger them to function which will return
the name back to API gateway which should hopefully come back to our browser.
There we go.
Hello Ryan Klinenberg.
And you might be wondering what this picture is.
This is my favorite photo in this whole wide world.
So this is my son athon.
This is May the 6th of February 2000 and 18 and that is the Falcon Heavy taking off sending a Tesla
to Mars so I was lucky enough to take a week off to go see that we were at Cape Canaveral and we watched
the Falcon Heavy which is the world's largest rocket ship in terms of thrust.
Take a Tesla into space.
Seriously it was one of the my favorite days in my whole life.
So I figured I'd just chop that up there.
If we do have any SpaceX engineers or Tesla engineers watching the coast big shout out to you.
Please tweet me massive fan.
Anyway you have done really really well.
You've taken your first step into a service.
This is a very very basic web site.
You can configure it any way that you want in the next two lectures we're going to split it up into
two parts we're going to create a service web site using poly.
So we're going to have the same sort of same you know bricks and mortar as what we've had in this one.
We're going to have API gateway we're going to have S3 going to have route 53 and then we are also going
to have Lamda but we're going to add in the poly service we're going to have multiple lambda functions
and we're also going to have dynamite D-B as well.
It's going to be a bit more full on.
But once you have created that you'll be able to cut and paste your notes into that that will then run
the notes through the Public Service creating MP 3 files which will be stored in S3 and then in the
very last lecture in this series we're going to create and alecks a skill that will play those.
So go ahead go have a break.
And if you've got the time please join me in the next lecture.