0% found this document useful (0 votes)
3 views

AWS_Session_4_14-06-2023

Uploaded by

Attif Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

AWS_Session_4_14-06-2023

Uploaded by

Attif Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Summer Day 4 - AWS #BETHECREATOR

AWS Session
Summary 14-06-2023

● Use of API Gateway: When you have multiple functions or apps or


microservices, you want the customer to reach any of them using just one
URL. You can set up an API Gateway that will route the user to the desired
location based on the /path they entered.

● API gateway is helping the user reach the final destination. It’s providing an
interface, a kind of door to the final application. Hence, it is called API,
Application Programming Interface. API gateway server can be set up
and launched on the cloud by using AWS API Gateway.

● The google.com example:

➢ Whenever you type google.com, you hit the API Gateway running in
Google’s server.

➢ www.google.com is the IP address/hostname/domain name of the


computer onto which the API Gateway is running.

➢ According to the /path, you’ll be sent to either /search or /mail in this


example.

Summer Industrial Training 2023 1


Summer Day 4 - AWS #BETHECREATOR

➢ The default rule always takes the user to /search, if /path is not
specified. www.gmail.com is converted to www.google.com/mail in
background.

● Setting up API Gateway server practical:

➢ Log into the AWS account

➢ Search Lambda service:

➢ Click Create function. Give Function name as searchfunc and set Runtine
to Python 3.0

Summer Industrial Training 2023 2


Summer Day 4 - AWS #BETHECREATOR

➢ Create another function having the name mailfunc and set Runtine to Python
3.0

Summer Industrial Training 2023 3


Summer Day 4 - AWS #BETHECREATOR

● These functions will be running your private AWS account. To give outside
people access to it, we will set up API Gateway.

➢ Search API Gateway.

➢ Click Create API

➢ Look for REST API and click Build.

Summer Industrial Training 2023 4


Summer Day 4 - AWS #BETHECREATOR

➢ In the Settings bar, set the API name as myApiGateway. Click Create API
button.

● API will manage for you the hardware, networking, route, and public IP
address. It can also manage the load by scaling the servers in times of
incoming of sudden traffic. It is highly scalable with good performance.

● EC2 service is an on-demand service and charges you for the number of
computers you launch even when there is no traffic on your web app.

Summer Industrial Training 2023 5


Summer Day 4 - AWS #BETHECREATOR

● API Gateway charges you per request wise. Hence, saves cost as well.

➢ Click Actions and select Create Resource.

➢ Set the Resource name as search. Finally, click Create Resource.

➢ First click the “/”, then create another resource with the Resource name as
mail.

Summer Industrial Training 2023 6


Summer Day 4 - AWS #BETHECREATOR

● When visiting a website, a user sends the following:

Protocol: http/https

Url

Route: /path

Verb: GET/ POST / …

● The Gateway will respond to a request only when the route and the verb
match that of an existing Lambda function.

➢ Click on /mail > Actions > Create Method > select GET

Summer Industrial Training 2023 7


Summer Day 4 - AWS #BETHECREATOR

➢ Choose Integration type as Lambda Function. Enter Lambda Function name


as mailfunc, and Save.

➢ Click on /search > Actions > Create Method > select GET

➢ Choose Integration type as Lambda Function. Enter the Lambda Function


name as searchfunc, and Save.

Summer Industrial Training 2023 8


Summer Day 4 - AWS #BETHECREATOR

➢ Select Action > Deploy API > Give Deployment stage and Stage name >
Deploy

➢ Save Changes

Summer Industrial Training 2023 9


Summer Day 4 - AWS #BETHECREATOR

➢ Here’s the URL to your website.

● The API Gateway server is not running yet. But as soon as a client hits its
URL using either /mail or /search paths, the server will start running and
give output. This model is called pay-as-you-go. It is highly scalable and has
optimized performance. It is very cost-effective as well.

Summer Industrial Training 2023 10

You might also like