SlideShare a Scribd company logo
1 of 32
Download to read offline
Back-end Development
Intro to AWS and Flask
Rough Plan (please add to this, it is just some rough
ideas I had)
Me:
intro to AWS slides
○ What it is
○ why should you learn about it
○ AWS services
○ pricing
○ what is RDS
● Setting up an RDS database
● me connecting to it
● set up AWS user and permissions for Milind to connect
Milind stuff
● slides talking about what flask is, what it’s used for, flask basics, quick recap on HTTP methods (don’t really need to go into detail just
maybe say what for example a POST request is used for generally and give an example of a complete POST request (an example
payload, and response) , maybe just list out all the SQL commands we are going to use ahead of time on the slides just so they don’t
get overwhelmed when they see them in the code). They should have some exposure to SQL because of the WISC sql workshops
though), etc
● Make a REST api with endpoints GET api/articles/:id, GET api/articles/, POST api/articles, /PUT api/articles/id (let’s use ‘articles’
instead of posts to make it less confusing (HTTP post vs an actual post)
● a post consists of three things: title, body, author (let’s avoid using images to avoid unnecessary complexity)
● push your stuff to a git repository
● Basically just a bunch of servers that can be accessed through the internet
● For example.
○ Ex. you could be storing documents in the cloud if you use
OneDrive/Google Drive/etc
○ If you run your python program on Google’s servers, you can say that
you are running your python program in the ‘cloud’
What is the cloud?
What is AWS?
● Amazon Web Services (AWS) is a cloud service provider
● on-demand delivery of IT resources over the internet
● Examples of it’s services include:
○ Elastic Compute Engine (EC2) - virtual machine
○ Relational Database Service (RDS) - database
○ Amazon S3 - cloud object storage
○ Over 200 more!
● Anything your app needs, AWS probably has a service to help you!
○ youtube.com/watch?v=JIbIYCM48to
Why learn AWS?
● AWS is the leading cloud service provider in the world
● Used by companies like Netflix, Sony, Disney, Nasa, Epic Games, Reddit, etc .
● It’s an extremely useful skill to have on your resume!
source:https://www.statista.com/chart/18819/worldwide-market-share-of-leading-cloud-infrastructure-service-providers/:
Benefits of using the cloud
● Trade capital expense for variable expense
● Don’t need to know how much hardware you need upfront
● Increase Agility ex. only takes a couple clicks to launch a website
● Extremely easy to deploy your products globally
● Benefit from massive economies of scale -> costs less to do stuff in the cloud!
● Don’t need to maintain hardware anymore!
From a software engineering POV
What we’ll be doing in today’s workshop
REST API (running
on AWS EC2)
Database (running
on AWS RDS)
● “A software intermediary that allows two applications to talk to each other.”
● How can the front-end get data from the back-end?
What is an API
?
What’s an API’s purpose?
● We could let the front-end deal with all the complexity of retrieving the data
○ i.e connecting to database, querying the database, structuring/filtering
the data that came from the database, etc
What is an API? continued
What is an API? continued
What’s an API’s purpose?
● Better way:
○ Front-end send requests to specific ‘endpoints’ on the back-end and
waits for data to be sent back
■ Ex. http://some-server/api/cats
■ Ex. http://some-server/api/users/2
○ Let the back-end deal with all the internal complexity!
○ Similar to how we create public interfaces with classes in languages
like Python/Java/etc (users need to know what’s going on internally in
class, we can just use its methods and attributes)
● Say I want to retrieve some data about all the users of my application
● I can just send a GET request to http://my-server/api/users and I will get
back some data like this:
●
[
{
first_name: “Bobby”,
last_name: “Daniels”
},
{
first_name: “Paul”,
last_name: “Smith”
}
[
For example...
HTTP Request Methods
GET: Retrieve a resource (some data) on the server
POST: Create a new resource on the server
PUT: Update a resource on the server
DELETE: Delete a resource
etc.
and when to use each
Quick Demo of what we will be making
AWS Services that we will be
using today to make it
EC2 = Elastic Compute Engine
● A virtual machine that runs on AWS’ physical servers
● You can run any OS you want on it, including Ubuntu, Amazon Linux,
MacOS, WIndows, etc.
● You can upgrade an EC2 instance to whatever specs you’d like (including
memory, cpu, storage)
● Examples of what you can do:
○ Run demanding tasks (maybe training a ML model, performing large
scale data analysis, etc)
○ Host a minecraft server
○ Do (almost) anything you could with a normal computer!
AWS EC2
RDS = Relational Database Service
● A managed PostgreSQL/MySQL/Oracle/etc database
● Some cool features of this service
○ Offers automatic database backups
○ Auto-scaling (the database can scale up and down in terms of its
processing power depending on the current demand)
○ etc.
AWS RDS
Additional AWS Topics
A security group acts as a firewall that controls what gets in and out of your
EC2/RDS/etc instances.
Example:
AWS Security Group
AWS VPC
VPC - Virtual Private Cloud
● Your own private network within AWS
● A logically isolated section of the AWS Cloud where you can launch AWS
resources in a virtual network that you define
● Don’t worry about this for this workshop!
AWS Free Tier
AWS RDS Pricing
Let’s set up a Database on AWS!
Flask is Python based lightweight framework used to
build web applications.
We will be using Flask to make an API today.
API (Application Programming Interface) is an application
that provides an interface so that the database and the
frontend can interact. API uses HTTP request to
communicate with frontend.
Python Flask
200 OK: The response has succeeded!
201 Created: The request has succeeded, and the resource has been created (usually for POST)
400 Bad Request: The server could not understand the request due to invalid syntax
401 Unauthorized: The client is not allowed to get the requested response
404 Not Found: The server cannot find the requested resource
418 Unprocessable Entity: The server unable to process the contained instructions.
500 Internal Server Error: The server has encountered an issue while processing your request
HTTP Request
We can make different types of requests: GET, POST, PUT, PATCH, etc
Example:
POST /articles
{
author: ‘gdsc’,
title: ‘welcome to apis’,
body: ‘blah blah blah’
}
Making a request
Allows you to use ORM (Object Relational mapping), which provides an interface
for using OOPs to interact with database.
This allows you to not write raw SQL
Flask SQLAlchemy
db.Model Ability to create and manipulate models/tables
db.session Ability to create and manipulate transactions/queries
db.session.add(person) It is used as an insert SQL Query
db.session.commit() It is used to run the transaction
Model is a description of the database table in ‘class’ form. This helps
SQLAlchemy map the database table to an object.
Serialization is converting the object in a more readable form.
For example:
<Article 1> is an object of article but you don’t want to send the object itself so
you convert this object to something like:
{
title: ‘welcome to gdsc’,
body: ‘blah blah blah’
}
Model and Serialization
Useful functions
MyModel.query Used to return the query table
MyModel.query.filter_by(<expression>)
eg : name = 'Milind'
Used to filter the query object and return
only the one/many you asked for
MyModel.query.filter(<expression>)
eg: Person.name ="Milind", Team.name = "Pod7"
More flexible to use like filter_by method
MyModel.query.first() Used to get the first result of a query/list of
responses
MyModel.query.all() Used to get all the results of a query
MyModel.query.limit(<number>).all() Used to get a limited number of response
Note that “MyModel” is just some arbitrary model that we made up for this slide
api.py (used to create the endpoints)
Basics
model.py (used to describe the database)
Connecting to Database
Let’s create an API !!
IF YOU START UP ANY AWS RESOURCES,
PLEASE REMEMBER TO DELETE THEM
WHEN YOU ARE DONE USING THEM. WE
ARE NOT RESPONSIBLE FOR ANY
FINANCIAL LOSSES if you forget to do
this :)))
Thanks for coming
today!

More Related Content

Similar to Back-end (Flask_AWS)

Introduction to amazon web services for developers
Introduction to amazon web services for developersIntroduction to amazon web services for developers
Introduction to amazon web services for developersCiklum Ukraine
 
Why Scale Matters and How the Cloud is Really Different (at scale)
Why Scale Matters and How the Cloud is Really Different (at scale)Why Scale Matters and How the Cloud is Really Different (at scale)
Why Scale Matters and How the Cloud is Really Different (at scale)Amazon Web Services
 
Not Your Father’s Web App: The Cloud-Native Architecture of images.nasa.gov
Not Your Father’s Web App: The Cloud-Native Architecture of images.nasa.govNot Your Father’s Web App: The Cloud-Native Architecture of images.nasa.gov
Not Your Father’s Web App: The Cloud-Native Architecture of images.nasa.govChris Shenton
 
Deep dive into cloud security - Jaimin Gohel & Virendra Rathore
Deep dive into cloud security - Jaimin Gohel & Virendra RathoreDeep dive into cloud security - Jaimin Gohel & Virendra Rathore
Deep dive into cloud security - Jaimin Gohel & Virendra RathoreNSConclave
 
Building Linked Data Platform with AWS
Building Linked Data Platform with AWSBuilding Linked Data Platform with AWS
Building Linked Data Platform with AWSEugeneMorozov
 
AWS Interview Questions and Answers.pdf
AWS Interview Questions and Answers.pdfAWS Interview Questions and Answers.pdf
AWS Interview Questions and Answers.pdfnishajeni1
 
AWS Interview Questions and Answers_2023.pdf
AWS Interview Questions and Answers_2023.pdfAWS Interview Questions and Answers_2023.pdf
AWS Interview Questions and Answers_2023.pdfnishajeni1
 
Windows Azure and a little SQL Data Services
Windows Azure and a little SQL Data ServicesWindows Azure and a little SQL Data Services
Windows Azure and a little SQL Data Servicesukdpe
 
AWS Cloud Kata | Kuala Lumpur - Getting to Scale on AWS
AWS Cloud Kata | Kuala Lumpur - Getting to Scale on AWSAWS Cloud Kata | Kuala Lumpur - Getting to Scale on AWS
AWS Cloud Kata | Kuala Lumpur - Getting to Scale on AWSAmazon Web Services
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backendDavid Padbury
 
無伺服器架構和Containers on AWS入門
無伺服器架構和Containers on AWS入門 無伺服器架構和Containers on AWS入門
無伺服器架構和Containers on AWS入門 Amazon Web Services
 
Getting Started with Serverless and Container Architectures
Getting Started with Serverless and Container ArchitecturesGetting Started with Serverless and Container Architectures
Getting Started with Serverless and Container ArchitecturesAmazon Web Services
 
Scaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million UsersScaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million UsersAmazon Web Services
 
Scaling on AWS to the First 10 Million Users
Scaling on AWS to the First 10 Million Users Scaling on AWS to the First 10 Million Users
Scaling on AWS to the First 10 Million Users mauerbac
 
Build Modern Web Apps Using ASP.NET Web API and AngularJS
Build Modern Web Apps Using ASP.NET Web API and AngularJSBuild Modern Web Apps Using ASP.NET Web API and AngularJS
Build Modern Web Apps Using ASP.NET Web API and AngularJSTaiseer Joudeh
 
AWS Certified Solutions Architect Professional Course S15-S18
AWS Certified Solutions Architect Professional Course S15-S18AWS Certified Solutions Architect Professional Course S15-S18
AWS Certified Solutions Architect Professional Course S15-S18Neal Davis
 
AWS Cloud Kata | Bangkok - Getting to Scale on AWS
AWS Cloud Kata | Bangkok - Getting to Scale on AWSAWS Cloud Kata | Bangkok - Getting to Scale on AWS
AWS Cloud Kata | Bangkok - Getting to Scale on AWSAmazon Web Services
 

Similar to Back-end (Flask_AWS) (20)

Introduction to amazon web services for developers
Introduction to amazon web services for developersIntroduction to amazon web services for developers
Introduction to amazon web services for developers
 
AWS glue technical enablement training
AWS glue technical enablement trainingAWS glue technical enablement training
AWS glue technical enablement training
 
Why Scale Matters and How the Cloud is Really Different (at scale)
Why Scale Matters and How the Cloud is Really Different (at scale)Why Scale Matters and How the Cloud is Really Different (at scale)
Why Scale Matters and How the Cloud is Really Different (at scale)
 
Not Your Father’s Web App: The Cloud-Native Architecture of images.nasa.gov
Not Your Father’s Web App: The Cloud-Native Architecture of images.nasa.govNot Your Father’s Web App: The Cloud-Native Architecture of images.nasa.gov
Not Your Father’s Web App: The Cloud-Native Architecture of images.nasa.gov
 
Deep dive into cloud security - Jaimin Gohel & Virendra Rathore
Deep dive into cloud security - Jaimin Gohel & Virendra RathoreDeep dive into cloud security - Jaimin Gohel & Virendra Rathore
Deep dive into cloud security - Jaimin Gohel & Virendra Rathore
 
Building Linked Data Platform with AWS
Building Linked Data Platform with AWSBuilding Linked Data Platform with AWS
Building Linked Data Platform with AWS
 
AWS Interview Questions and Answers.pdf
AWS Interview Questions and Answers.pdfAWS Interview Questions and Answers.pdf
AWS Interview Questions and Answers.pdf
 
AWS Interview Questions and Answers_2023.pdf
AWS Interview Questions and Answers_2023.pdfAWS Interview Questions and Answers_2023.pdf
AWS Interview Questions and Answers_2023.pdf
 
Windows Azure and a little SQL Data Services
Windows Azure and a little SQL Data ServicesWindows Azure and a little SQL Data Services
Windows Azure and a little SQL Data Services
 
AWS Cloud Kata | Kuala Lumpur - Getting to Scale on AWS
AWS Cloud Kata | Kuala Lumpur - Getting to Scale on AWSAWS Cloud Kata | Kuala Lumpur - Getting to Scale on AWS
AWS Cloud Kata | Kuala Lumpur - Getting to Scale on AWS
 
BDA311 Introduction to AWS Glue
BDA311 Introduction to AWS GlueBDA311 Introduction to AWS Glue
BDA311 Introduction to AWS Glue
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
 
Azure for ug
Azure for ugAzure for ug
Azure for ug
 
無伺服器架構和Containers on AWS入門
無伺服器架構和Containers on AWS入門 無伺服器架構和Containers on AWS入門
無伺服器架構和Containers on AWS入門
 
Getting Started with Serverless and Container Architectures
Getting Started with Serverless and Container ArchitecturesGetting Started with Serverless and Container Architectures
Getting Started with Serverless and Container Architectures
 
Scaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million UsersScaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million Users
 
Scaling on AWS to the First 10 Million Users
Scaling on AWS to the First 10 Million Users Scaling on AWS to the First 10 Million Users
Scaling on AWS to the First 10 Million Users
 
Build Modern Web Apps Using ASP.NET Web API and AngularJS
Build Modern Web Apps Using ASP.NET Web API and AngularJSBuild Modern Web Apps Using ASP.NET Web API and AngularJS
Build Modern Web Apps Using ASP.NET Web API and AngularJS
 
AWS Certified Solutions Architect Professional Course S15-S18
AWS Certified Solutions Architect Professional Course S15-S18AWS Certified Solutions Architect Professional Course S15-S18
AWS Certified Solutions Architect Professional Course S15-S18
 
AWS Cloud Kata | Bangkok - Getting to Scale on AWS
AWS Cloud Kata | Bangkok - Getting to Scale on AWSAWS Cloud Kata | Bangkok - Getting to Scale on AWS
AWS Cloud Kata | Bangkok - Getting to Scale on AWS
 

More from GDSC UofT Mississauga

ICCIT Council × GDSC: UX / UI and Figma
ICCIT Council × GDSC: UX / UI and FigmaICCIT Council × GDSC: UX / UI and Figma
ICCIT Council × GDSC: UX / UI and FigmaGDSC UofT Mississauga
 
Community Projects Info Session Fall 2023
Community Projects Info Session Fall 2023Community Projects Info Session Fall 2023
Community Projects Info Session Fall 2023GDSC UofT Mississauga
 
MCSS × GDSC: Intro to Cybersecurity Workshop
MCSS × GDSC: Intro to Cybersecurity WorkshopMCSS × GDSC: Intro to Cybersecurity Workshop
MCSS × GDSC: Intro to Cybersecurity WorkshopGDSC UofT Mississauga
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]GDSC UofT Mississauga
 

More from GDSC UofT Mississauga (20)

CSSC ML Workshop
CSSC ML WorkshopCSSC ML Workshop
CSSC ML Workshop
 
ICCIT Council × GDSC: UX / UI and Figma
ICCIT Council × GDSC: UX / UI and FigmaICCIT Council × GDSC: UX / UI and Figma
ICCIT Council × GDSC: UX / UI and Figma
 
Community Projects Info Session Fall 2023
Community Projects Info Session Fall 2023Community Projects Info Session Fall 2023
Community Projects Info Session Fall 2023
 
GDSC x Deerhacks - Origami Workshop
GDSC x Deerhacks - Origami WorkshopGDSC x Deerhacks - Origami Workshop
GDSC x Deerhacks - Origami Workshop
 
Reverse Engineering 101
Reverse Engineering 101Reverse Engineering 101
Reverse Engineering 101
 
Michael's OWASP Juice Shop Workshop
Michael's OWASP Juice Shop WorkshopMichael's OWASP Juice Shop Workshop
Michael's OWASP Juice Shop Workshop
 
MCSS × GDSC: Intro to Cybersecurity Workshop
MCSS × GDSC: Intro to Cybersecurity WorkshopMCSS × GDSC: Intro to Cybersecurity Workshop
MCSS × GDSC: Intro to Cybersecurity Workshop
 
Basics of C
Basics of CBasics of C
Basics of C
 
Discord Bot Workshop Slides
Discord Bot Workshop SlidesDiscord Bot Workshop Slides
Discord Bot Workshop Slides
 
Web Scraping Workshop
Web Scraping WorkshopWeb Scraping Workshop
Web Scraping Workshop
 
Devops Workshop
Devops WorkshopDevops Workshop
Devops Workshop
 
Express
ExpressExpress
Express
 
HTML_CSS_JS Workshop
HTML_CSS_JS WorkshopHTML_CSS_JS Workshop
HTML_CSS_JS Workshop
 
DevOps Workshop Part 1
DevOps Workshop Part 1DevOps Workshop Part 1
DevOps Workshop Part 1
 
Docker workshop GDSC_CSSC
Docker workshop GDSC_CSSCDocker workshop GDSC_CSSC
Docker workshop GDSC_CSSC
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
Git Init (Introduction to Git)
Git Init (Introduction to Git)Git Init (Introduction to Git)
Git Init (Introduction to Git)
 
Database Workshop Slides
Database Workshop SlidesDatabase Workshop Slides
Database Workshop Slides
 
ChatGPT General Meeting
ChatGPT General MeetingChatGPT General Meeting
ChatGPT General Meeting
 
Elon & Twitter General Meeting
Elon & Twitter General MeetingElon & Twitter General Meeting
Elon & Twitter General Meeting
 

Recently uploaded

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Back-end (Flask_AWS)

  • 2. Rough Plan (please add to this, it is just some rough ideas I had) Me: intro to AWS slides ○ What it is ○ why should you learn about it ○ AWS services ○ pricing ○ what is RDS ● Setting up an RDS database ● me connecting to it ● set up AWS user and permissions for Milind to connect Milind stuff ● slides talking about what flask is, what it’s used for, flask basics, quick recap on HTTP methods (don’t really need to go into detail just maybe say what for example a POST request is used for generally and give an example of a complete POST request (an example payload, and response) , maybe just list out all the SQL commands we are going to use ahead of time on the slides just so they don’t get overwhelmed when they see them in the code). They should have some exposure to SQL because of the WISC sql workshops though), etc ● Make a REST api with endpoints GET api/articles/:id, GET api/articles/, POST api/articles, /PUT api/articles/id (let’s use ‘articles’ instead of posts to make it less confusing (HTTP post vs an actual post) ● a post consists of three things: title, body, author (let’s avoid using images to avoid unnecessary complexity) ● push your stuff to a git repository
  • 3. ● Basically just a bunch of servers that can be accessed through the internet ● For example. ○ Ex. you could be storing documents in the cloud if you use OneDrive/Google Drive/etc ○ If you run your python program on Google’s servers, you can say that you are running your python program in the ‘cloud’ What is the cloud?
  • 4. What is AWS? ● Amazon Web Services (AWS) is a cloud service provider ● on-demand delivery of IT resources over the internet ● Examples of it’s services include: ○ Elastic Compute Engine (EC2) - virtual machine ○ Relational Database Service (RDS) - database ○ Amazon S3 - cloud object storage ○ Over 200 more! ● Anything your app needs, AWS probably has a service to help you! ○ youtube.com/watch?v=JIbIYCM48to
  • 5. Why learn AWS? ● AWS is the leading cloud service provider in the world ● Used by companies like Netflix, Sony, Disney, Nasa, Epic Games, Reddit, etc . ● It’s an extremely useful skill to have on your resume! source:https://www.statista.com/chart/18819/worldwide-market-share-of-leading-cloud-infrastructure-service-providers/:
  • 6. Benefits of using the cloud ● Trade capital expense for variable expense ● Don’t need to know how much hardware you need upfront ● Increase Agility ex. only takes a couple clicks to launch a website ● Extremely easy to deploy your products globally ● Benefit from massive economies of scale -> costs less to do stuff in the cloud! ● Don’t need to maintain hardware anymore! From a software engineering POV
  • 7. What we’ll be doing in today’s workshop REST API (running on AWS EC2) Database (running on AWS RDS)
  • 8. ● “A software intermediary that allows two applications to talk to each other.” ● How can the front-end get data from the back-end? What is an API ?
  • 9. What’s an API’s purpose? ● We could let the front-end deal with all the complexity of retrieving the data ○ i.e connecting to database, querying the database, structuring/filtering the data that came from the database, etc What is an API? continued
  • 10. What is an API? continued What’s an API’s purpose? ● Better way: ○ Front-end send requests to specific ‘endpoints’ on the back-end and waits for data to be sent back ■ Ex. http://some-server/api/cats ■ Ex. http://some-server/api/users/2 ○ Let the back-end deal with all the internal complexity! ○ Similar to how we create public interfaces with classes in languages like Python/Java/etc (users need to know what’s going on internally in class, we can just use its methods and attributes)
  • 11. ● Say I want to retrieve some data about all the users of my application ● I can just send a GET request to http://my-server/api/users and I will get back some data like this: ● [ { first_name: “Bobby”, last_name: “Daniels” }, { first_name: “Paul”, last_name: “Smith” } [ For example...
  • 12. HTTP Request Methods GET: Retrieve a resource (some data) on the server POST: Create a new resource on the server PUT: Update a resource on the server DELETE: Delete a resource etc. and when to use each
  • 13. Quick Demo of what we will be making
  • 14. AWS Services that we will be using today to make it
  • 15. EC2 = Elastic Compute Engine ● A virtual machine that runs on AWS’ physical servers ● You can run any OS you want on it, including Ubuntu, Amazon Linux, MacOS, WIndows, etc. ● You can upgrade an EC2 instance to whatever specs you’d like (including memory, cpu, storage) ● Examples of what you can do: ○ Run demanding tasks (maybe training a ML model, performing large scale data analysis, etc) ○ Host a minecraft server ○ Do (almost) anything you could with a normal computer! AWS EC2
  • 16. RDS = Relational Database Service ● A managed PostgreSQL/MySQL/Oracle/etc database ● Some cool features of this service ○ Offers automatic database backups ○ Auto-scaling (the database can scale up and down in terms of its processing power depending on the current demand) ○ etc. AWS RDS
  • 18. A security group acts as a firewall that controls what gets in and out of your EC2/RDS/etc instances. Example: AWS Security Group
  • 19. AWS VPC VPC - Virtual Private Cloud ● Your own private network within AWS ● A logically isolated section of the AWS Cloud where you can launch AWS resources in a virtual network that you define ● Don’t worry about this for this workshop!
  • 20. AWS Free Tier AWS RDS Pricing
  • 21. Let’s set up a Database on AWS!
  • 22. Flask is Python based lightweight framework used to build web applications. We will be using Flask to make an API today. API (Application Programming Interface) is an application that provides an interface so that the database and the frontend can interact. API uses HTTP request to communicate with frontend. Python Flask
  • 23. 200 OK: The response has succeeded! 201 Created: The request has succeeded, and the resource has been created (usually for POST) 400 Bad Request: The server could not understand the request due to invalid syntax 401 Unauthorized: The client is not allowed to get the requested response 404 Not Found: The server cannot find the requested resource 418 Unprocessable Entity: The server unable to process the contained instructions. 500 Internal Server Error: The server has encountered an issue while processing your request HTTP Request
  • 24. We can make different types of requests: GET, POST, PUT, PATCH, etc Example: POST /articles { author: ‘gdsc’, title: ‘welcome to apis’, body: ‘blah blah blah’ } Making a request
  • 25. Allows you to use ORM (Object Relational mapping), which provides an interface for using OOPs to interact with database. This allows you to not write raw SQL Flask SQLAlchemy db.Model Ability to create and manipulate models/tables db.session Ability to create and manipulate transactions/queries db.session.add(person) It is used as an insert SQL Query db.session.commit() It is used to run the transaction
  • 26. Model is a description of the database table in ‘class’ form. This helps SQLAlchemy map the database table to an object. Serialization is converting the object in a more readable form. For example: <Article 1> is an object of article but you don’t want to send the object itself so you convert this object to something like: { title: ‘welcome to gdsc’, body: ‘blah blah blah’ } Model and Serialization
  • 27. Useful functions MyModel.query Used to return the query table MyModel.query.filter_by(<expression>) eg : name = 'Milind' Used to filter the query object and return only the one/many you asked for MyModel.query.filter(<expression>) eg: Person.name ="Milind", Team.name = "Pod7" More flexible to use like filter_by method MyModel.query.first() Used to get the first result of a query/list of responses MyModel.query.all() Used to get all the results of a query MyModel.query.limit(<number>).all() Used to get a limited number of response Note that “MyModel” is just some arbitrary model that we made up for this slide
  • 28. api.py (used to create the endpoints) Basics model.py (used to describe the database)
  • 31. IF YOU START UP ANY AWS RESOURCES, PLEASE REMEMBER TO DELETE THEM WHEN YOU ARE DONE USING THEM. WE ARE NOT RESPONSIBLE FOR ANY FINANCIAL LOSSES if you forget to do this :)))