SlideShare a Scribd company logo
1 of 76
© 2019, Amazon Web Services, Inc. or its Affiliates.© 2019, Amazon Web Services, Inc. or its Affiliates.
Sergey Pugachev
GraphQL backend with
AWS AppSync & AWS Lambda
Solutions Architect, AWS
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Fullstack
https://www.flickr.com/photos/ginnerobot/2549674908/
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Backend
Front end
CI/CD
https://www.flickr.com/photos/ginnerobot/2549674908/
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
No servers to provision
or manage
Scales with usage
Never pay for idle Availability and fault
tolerance built in
Serverless means…
© 2019, Amazon Web Services, Inc. or its Affiliates.
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Cloud Services
Cloud
Less More
Compute Virtual Machine
EC2 Elastic Beanstalk AWS LambdaFargate
Databases MySQL MySQL on EC2
RDS MySQL RDS Aurora Aurora Serverless DynamoDB
Storage Storage
S3
Messaging ESBs
Amazon MQ Kinesis SQS / SNS
Analytics
Hadoop Hadoop on EC2 EMR Elasticsearch Service Athena
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Docker orchestration in the cloud
Management
Hosting
Amazon Elastic
Container Service
Amazon Elastic
Kubernetes Service
Amazon EC2 AWS Fargate
Image Registry Amazon Elastic
Container Registry
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Upstream Kubernetes
Use standard Kubernetes APIs.
Works with community tools.
Highly available
Built for production workloads, all clusters are highly
available. Backed by a 99.9% SLA.
Integrated
with the AWS ecosystem: VPC Networking, Elastic Load
Balancing, IAM Permissions, CloudWatch and more
Amazon Elastic Kubernetes Service
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Managed by AWS
No EC2 Instances to provision, scale or manage
Elastic
Scale up & down seamlessly. Pay only for what you use
Integrated
with the AWS ecosystem: VPC Networking, Elastic Load
Balancing, IAM Permissions, CloudWatch and more. Run
Kubernetes pods or ECS tasks.
AWS Fargate
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
{API}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
InternetMobile &
web apps
Databases &
data stores
Basic API technology stack
Failover
Load balancers
Web & application servers
Message buses
Workers
?API
backend
?API
“server”
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS
InternetMobile &
web apps
Databases &
data stores
Basic API technology stack
Failover
Load balancers
Web & application servers
Message buses
Workers
?API
backend
?API
“server”
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
InternetMobile &
web apps
Basic serverless API technology stack
AWS
Serverless
business logic
Serverless
APIs
Databases &
data stores
Fail over
Load balancers
Web/application servers
Message buses
Workers
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
/posts /comments /authors
REST API
posts comments authors
GraphQL API
What is GraphQL?
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Queries MutationsTypes
Subscriptions
GraphQL schema and operations
A query language for APIs . . . and a runtime!
type User {
id: ID!
username: String!
firstName: String
lastName: String
daysActive: Int
}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Queries
query GetPost {
getPost(id: ”1”) {
id
title
}
}
mutation CreatePost {
createPost(title: “Summit”) {
id
title
}
}
subscription OnCreatePost {
onCreatePost {
id
title
}
}
Mutations Subscriptions
A query language for APIs . . .
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS AppSync
Managed serverless
GraphQL service
Connect to data
sources in your account
Add data sync, real-time, and
offline capabilities for any data
source or API
GraphQL facade for any
AWS service
Conflict detection and
resolution in the cloud
Enterprise security features:
IAM, Amazon Cognito, OIDC,
API keys
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How does AWS AppSync work?
,
,
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL data flow in AWS AppSync: Resolvers
Request template Response template
Data sources
1 2 3 4 5
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Pipeline resolvers
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Real-time data broadcasting
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Real-time subscriptions
subscription onCreateMessage {
createMessage {…}
}
WebSocket URL and connection payload
Secure WebSocket connection (wss://)
AppSync Data Sources
AWS AppSync
Amazon
DynamoDB
Amazon Elasticsearch
Service
AWS Lambda
Amazon Aurora
HTTP
Local (Pub/Sub)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Offline
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Polyglot backend data access
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amplify Framework
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amplify Framework
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amplify Framework
ü CLI
ü Client libraries (native and JS support)
ü Console – Continuous deployment
and hosting
ü Prebuilt UI components
ü Toolchain
ü JS framework support
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
• Create, update, and delete cloud services
• Manage multiple environments
• GraphQL Transform
• GraphQL Codegen
Amplify Framework
CLI
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Categories
Authentication
Analytics
Interactions (chat bots)
API (REST)
API (GraphQL)
Amplify CLI
Serverless functions
Storage
XR
Push notifications
Video
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
$ amplify add auth
$ amplify push
$ amplify configure auth
$ amplify delete
$ amplify codegen add
Amplify CLI
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
$ amplify add api
–
# schema.graphql
type Post @model {
id: ID!
title: String!
}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
@model
Top-level entity; creates DynamoDB table, resolvers, and additional schema (queries,
mutations, and subscriptions) for base type
@connection
Enables relationships between @model types
@auth
Enables set of authorization rules
@searchable
Handles streaming the data of an @model object type to Amazon Elasticsearch Service
and configures search resolvers
@versioned
Enables versioning
@function
Enables adding a Lambda function as a data source
–
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL Transform: Mix and match data sources
type Post {
id: ID!
content: String
description: String
ups: Int
downs: Int
}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL Transform: Mix and match data sources
createPost
readPost
updatePost
deletePost
type Post
@model {
id: ID!
content: String
description: String
ups: Int
downs: Int
}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL Transform: Mix and match data sources
mutations
queries
createPost
readPost
updatePost
deletePost
type Post
@model
@auth(rules: [{allow:
owner}]){
id: ID!
content: String
description: String
ups: Int
downs: Int
}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL Transform: Mix and match data sources
searchPosts
mutations
queries
createPost
readPost
updatePost
deletePost
type Post
@model
@auth(rules: [{allow: owner}])
@searchable{
id: ID!
content: String
description: String
ups: Int
downs: Int
}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL Transform: Mix and match data sources
searchPosts
mutations
queries
createPost
readPost
updatePost
deletePost
type Post
@model
@auth(rules: [{allow:
owner}])
@searchable{
id: ID!
content: String
description: String
ups: Int
downs: Int
}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
$ amplify add codegen [--apiId <api-id>]
// Will generate GraphQL statements
// (queries, mutations, subscriptions)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
$ amplify env add
$ amplify env list
$ amplify env checkout
$ amplify env remove
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Multiple environments and team workflow
• Git-style interaction and project switching
• Share backends between team members or clone for sandbox isolated development
User Users
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amplify Framework
• Connect to and interact with cloud services from web and mobile
applications
• Preconfigured components for popular front-end libraries
Client
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Amplify client
• Opinionated
• Declarative
• Client focused
• High-level abstractions
• Best practices built in
• Built with Amplify CLI in mind
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Amplify client
import {
Auth, API, Storage, Analytics, XR
} from ‘aws-amplify’
$ npm install aws-amplify
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Amplify client
import {
Auth
} from ‘aws-amplify’
Auth.signIn(’myusername’, ‘mypassword’)
Auth.signOut()
Auth.currentAuthenticatedUser()
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Amplify: Native support
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Amplify: JS framework support
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Higher-order components
import {withAuthenticator} from ‘aws-amplify-react’
export default withAuthenticator(App)
class App extends Component {
// your code goes here
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon API Gateway
Amazon Pinpoint
AWS Lambda
AWS AppSync Amazon DynamoDBAmazon Cognito
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Deploying a Lambda function with API Gateway
1. Create the Lambda function & API
$ amplify add api
// chose REST with Express backend
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2. Write code/make changes
// amplify/backend/function/<FUNCTION_NAME>/src/app.js
app.get(‘/items’, function(req, res) {
// new code goes here
})
Deploying a Lambda function with API Gateway
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
$ amplify push
3. Deploy new API
Deploying a Lambda function with API Gateway
Amazon API Gateway AWS Lambda
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
import { API } from ‘aws-amplify’
API.get(’/items’)
.then(data => console.log({ data }))
.catch(err => console.log({ err })
4. Interact with the API
Deploying a Lambda function with API Gateway
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
$ amplify add auth
// choose either default or custom configuration
1. Create the authentication service
Adding authentication
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
import { Auth } from ‘aws-amplify’
2. Import the Auth component
Adding authentication
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Auth.signUp(‘username’, ‘password’, {
attributes: { email: ‘jane@doe.com’ }
})
Auth.signIn(’myusername’, ‘mypassword’)
3. Implement Auth methods
Adding authentication
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
$ amplify add api
// chose GraphQL
1. Create the GraphQL API
Deploying a GraphQL API
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
type Todo @model {
id: ID!
name: String!
description: String!
completed: Boolean
}
2. Define annotated GraphQL schema
Deploying a GraphQL API
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
$ amplify push
3. Deploy new API
Deploying a GraphQL API
Amazon Cognito AWS AppSync Amazon DynamoDB
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
import { API, GraphqlOperation } from ‘aws-amplify’
import { listTodos } from ‘./src/graphql/queries’
API.graphql(graphqlOperation(listTodos))
.then(data => console.log({ data }))
.catch(err => console.log({ err })
4. Interact with API
Deploying a GraphQL API
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
$ amplify add analytics
$ amplify push
1. Create analytics service
Adding analytics
Amazon Pinpoint
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2. Import Analytics API
Adding analytics
import { Analytics } from ‘aws-amplify’
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
3. Record events
Adding analytics
Analytics.record({ name: 'albumVisit’ })
Analytics.record({
name: 'albumVisit', // Attribute values must be strings
attributes: { genre: ‘nu-metal', artist: ’RATM’ }
})
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon API Gateway
Amazon Pinpoint
AWS Lambda
AWS AppSync Amazon DynamoDBAmazon Cognito
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS AppSync JS SDK
• Offline ready
• Built-in helpers for optimistic response,
subscriptions
• Use with React Apollo / Vue Apollo /
Angular Apollo
• https://github.com/awslabs/aws-mobile-appsync-sdk-js
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Fullstack DevOps for web apps
• Strong isolation barrier between projects and stages
Dedicated AWS accounts for each project and stage (sandbox, staging, prod)
• Source code (and history) for each stage readily available
Git branching used for the source code for each stage
• Minimize version mismatches between front end and backend
Front end (e.g., code) and backend (e.g., AWS CloudFormation templates)
developed and versioned together in same Git repository
• Developers in control
Developers deploy front end *and* backend
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DevOps requirements for modern web apps
Web app
per dev
sandbox
Test web app Prod web app
Isolated
backends
Shared backend
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DevOps challenges with modern web apps
Lots of moving parts complicate the following:
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Amplify Console
Build, deploy, and host cloud-powered modern web apps
Optional deployment of backend resources +
fully managed front-end hosting
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Use cases
Use static site generators like Hugo or Jekyll
to publish a blog. SSGs perform faster than
traditional websites. Deploy SSGs with free
SSL on the AWS Amplify Console.
Add dynamic functionality using GraphQL or
REST APIs. Use the AWS Amplify Console to
deploy your front end and backend in a single
workflow.
PWAs offer native app-like performance, work
offline, support push notifications, and can be
updated over the air. Use AWS Amplify to
deploy PWAs to mobile devices.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2019, Amazon Web Services, Inc. or its Affiliates.
Sergey Pugachev
GraphQL backend with
AWS AppSync & AWS Lambda
Solutions Architect, AWS

More Related Content

What's hot

What's hot (20)

Adding the Sec to Your DevOps Pipelines: AWS Security Week at the SF Loft
Adding the Sec to Your DevOps Pipelines: AWS Security Week at the SF LoftAdding the Sec to Your DevOps Pipelines: AWS Security Week at the SF Loft
Adding the Sec to Your DevOps Pipelines: AWS Security Week at the SF Loft
 
AWS Compute Evolved Week: Running Kubernetes on AWS
AWS Compute Evolved Week: Running Kubernetes on AWSAWS Compute Evolved Week: Running Kubernetes on AWS
AWS Compute Evolved Week: Running Kubernetes on AWS
 
Identity Round Robin Workshop - Serverless Round: Security Week at the SF Loft
Identity Round Robin Workshop - Serverless Round: Security Week at the SF LoftIdentity Round Robin Workshop - Serverless Round: Security Week at the SF Loft
Identity Round Robin Workshop - Serverless Round: Security Week at the SF Loft
 
Securing serverless and container services - SDD306 - AWS re:Inforce 2019
Securing serverless and container services - SDD306 - AWS re:Inforce 2019 Securing serverless and container services - SDD306 - AWS re:Inforce 2019
Securing serverless and container services - SDD306 - AWS re:Inforce 2019
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Simplificando Arquiteturas Microsoft com os Serviços da AWS - ARC204 - Sao P...
Simplificando Arquiteturas Microsoft com os Serviços da AWS -  ARC204 - Sao P...Simplificando Arquiteturas Microsoft com os Serviços da AWS -  ARC204 - Sao P...
Simplificando Arquiteturas Microsoft com os Serviços da AWS - ARC204 - Sao P...
 
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)
 
Scaling threat detection and response on AWS
Scaling threat detection and response on AWSScaling threat detection and response on AWS
Scaling threat detection and response on AWS
 
Learn how Maxwell Health Protects its MongoDB Workloads on AWS
 Learn how Maxwell Health Protects its MongoDB Workloads on AWS Learn how Maxwell Health Protects its MongoDB Workloads on AWS
Learn how Maxwell Health Protects its MongoDB Workloads on AWS
 
Set Up a CI/CD Pipeline for Deploying Containers Using the AWS Developer Tool...
Set Up a CI/CD Pipeline for Deploying Containers Using the AWS Developer Tool...Set Up a CI/CD Pipeline for Deploying Containers Using the AWS Developer Tool...
Set Up a CI/CD Pipeline for Deploying Containers Using the AWS Developer Tool...
 
Dev & Test on AWS Webinar October 2017 - IL Webinar
Dev & Test on AWS Webinar October 2017 - IL WebinarDev & Test on AWS Webinar October 2017 - IL Webinar
Dev & Test on AWS Webinar October 2017 - IL Webinar
 
Building a Secured Network environment on AWS
Building a Secured Network environment on AWSBuilding a Secured Network environment on AWS
Building a Secured Network environment on AWS
 
AWS business essentials
AWS business essentials AWS business essentials
AWS business essentials
 
Secure your AWS Account and your Organization's Accounts
Secure your AWS Account and your Organization's Accounts Secure your AWS Account and your Organization's Accounts
Secure your AWS Account and your Organization's Accounts
 
AWSome Day Digital LATAM
AWSome Day Digital LATAMAWSome Day Digital LATAM
AWSome Day Digital LATAM
 
Securing your block storage on AWS - GRC207 - AWS re:Inforce 2019
Securing your block storage on AWS - GRC207 - AWS re:Inforce 2019 Securing your block storage on AWS - GRC207 - AWS re:Inforce 2019
Securing your block storage on AWS - GRC207 - AWS re:Inforce 2019
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Design, Deploy, & Optimize SQL Server Workloads
Design, Deploy, & Optimize SQL Server Workloads Design, Deploy, & Optimize SQL Server Workloads
Design, Deploy, & Optimize SQL Server Workloads
 
Amazon CloudWatch (Container Insights)- AWS Container Day 2019 Barcelona
Amazon CloudWatch (Container Insights)- AWS Container Day 2019 BarcelonaAmazon CloudWatch (Container Insights)- AWS Container Day 2019 Barcelona
Amazon CloudWatch (Container Insights)- AWS Container Day 2019 Barcelona
 
01 aw some day_main track_aws basics
01 aw some day_main track_aws basics01 aw some day_main track_aws basics
01 aw some day_main track_aws basics
 

Similar to GraphQL backend with AWS AppSync & AWS Lambda

Similar to GraphQL backend with AWS AppSync & AWS Lambda (20)

"Integrate your front end apps with serverless backend in the cloud", Sebasti...
"Integrate your front end apps with serverless backend in the cloud", Sebasti..."Integrate your front end apps with serverless backend in the cloud", Sebasti...
"Integrate your front end apps with serverless backend in the cloud", Sebasti...
 
Amplifying fullstack serverless apps with AppSync & the Amplify Framework - M...
Amplifying fullstack serverless apps with AppSync & the Amplify Framework - M...Amplifying fullstack serverless apps with AppSync & the Amplify Framework - M...
Amplifying fullstack serverless apps with AppSync & the Amplify Framework - M...
 
Introduzione a GraphQL
Introduzione a GraphQLIntroduzione a GraphQL
Introduzione a GraphQL
 
Simplify your Web & Mobile applications with cloud-based serverless backends
Simplify your Web & Mobile applicationswith cloud-based serverless backendsSimplify your Web & Mobile applicationswith cloud-based serverless backends
Simplify your Web & Mobile applications with cloud-based serverless backends
 
Serverless APIs and you
Serverless APIs and youServerless APIs and you
Serverless APIs and you
 
Simplify front end apps.pdf
Simplify front end apps.pdfSimplify front end apps.pdf
Simplify front end apps.pdf
 
Simplify front end apps.pdf
Simplify front end apps.pdfSimplify front end apps.pdf
Simplify front end apps.pdf
 
AWS DevDay Berlin 2019 - Simplify your Web & Mobile apps with cloud-based ser...
AWS DevDay Berlin 2019 - Simplify your Web & Mobile appswith cloud-based ser...AWS DevDay Berlin 2019 - Simplify your Web & Mobile appswith cloud-based ser...
AWS DevDay Berlin 2019 - Simplify your Web & Mobile apps with cloud-based ser...
 
AWS Meetup Brussels 3rd Sep 2019 Simplify Frontend Apps with Serverless Backends
AWS Meetup Brussels 3rd Sep 2019 Simplify Frontend Apps with Serverless BackendsAWS Meetup Brussels 3rd Sep 2019 Simplify Frontend Apps with Serverless Backends
AWS Meetup Brussels 3rd Sep 2019 Simplify Frontend Apps with Serverless Backends
 
How to build a FullStack Airline Ticketing Web App.pdf
How to build a FullStack Airline Ticketing Web App.pdfHow to build a FullStack Airline Ticketing Web App.pdf
How to build a FullStack Airline Ticketing Web App.pdf
 
Marcia Villalba "Developing Serverless Applications with GraphQL"
Marcia Villalba "Developing Serverless Applications with GraphQL"Marcia Villalba "Developing Serverless Applications with GraphQL"
Marcia Villalba "Developing Serverless Applications with GraphQL"
 
Serverless days Stockholm - How to build a full-stack airline ticketing web app
Serverless days Stockholm - How to build a full-stack airline ticketing web appServerless days Stockholm - How to build a full-stack airline ticketing web app
Serverless days Stockholm - How to build a full-stack airline ticketing web app
 
20200513 Getting started with AWS Amplify
20200513   Getting started with AWS Amplify20200513   Getting started with AWS Amplify
20200513 Getting started with AWS Amplify
 
善用 GraphQL 與 AWS AppSync 讓您的 Progressive Web App (PWA) 加速進化 (Level 200)
善用  GraphQL 與 AWS AppSync 讓您的  Progressive Web App (PWA) 加速進化 (Level 200)善用  GraphQL 與 AWS AppSync 讓您的  Progressive Web App (PWA) 加速進化 (Level 200)
善用 GraphQL 與 AWS AppSync 讓您的 Progressive Web App (PWA) 加速進化 (Level 200)
 
Intro to AWS Amplify Toolchain: Mobile Week SF
Intro to AWS Amplify Toolchain: Mobile Week SFIntro to AWS Amplify Toolchain: Mobile Week SF
Intro to AWS Amplify Toolchain: Mobile Week SF
 
Build your APPs in Lean and Agile Way using AWS Amplify
Build your APPs in Lean and Agile Way using AWS AmplifyBuild your APPs in Lean and Agile Way using AWS Amplify
Build your APPs in Lean and Agile Way using AWS Amplify
 
ArmadaJS - how to build a full-stack airline ticketing web app
ArmadaJS - how to build a full-stack airline ticketing web appArmadaJS - how to build a full-stack airline ticketing web app
ArmadaJS - how to build a full-stack airline ticketing web app
 
AWSome Day 2019 - Mexico City
AWSome Day 2019 - Mexico CityAWSome Day 2019 - Mexico City
AWSome Day 2019 - Mexico City
 
Build a Photo-Sharing App with AI-Powered Face and Object Detection (MOB306) ...
Build a Photo-Sharing App with AI-Powered Face and Object Detection (MOB306) ...Build a Photo-Sharing App with AI-Powered Face and Object Detection (MOB306) ...
Build a Photo-Sharing App with AI-Powered Face and Object Detection (MOB306) ...
 
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
 

More from Aleksandr Maklakov

More from Aleksandr Maklakov (14)

AWS Certification from scratch
AWS Certification from scratchAWS Certification from scratch
AWS Certification from scratch
 
Chronicle of ReInvent 2019
Chronicle of ReInvent 2019Chronicle of ReInvent 2019
Chronicle of ReInvent 2019
 
How to stop dreaming about security and start implementing
How to stop dreaming about security and start implementingHow to stop dreaming about security and start implementing
How to stop dreaming about security and start implementing
 
Secure perimeter with AWS workspaces
Secure perimeter with  AWS workspacesSecure perimeter with  AWS workspaces
Secure perimeter with AWS workspaces
 
Going Serverless on AWS
Going Serverless on AWSGoing Serverless on AWS
Going Serverless on AWS
 
AWS Security Best Practices
AWS Security Best PracticesAWS Security Best Practices
AWS Security Best Practices
 
AWS Container services
AWS Container servicesAWS Container services
AWS Container services
 
How to implement DevSecOps on AWS for startups
How to implement DevSecOps on AWS for startupsHow to implement DevSecOps on AWS for startups
How to implement DevSecOps on AWS for startups
 
AWS CloudFront
AWS CloudFrontAWS CloudFront
AWS CloudFront
 
HOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLDHOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLD
 
Amazon EC2 container service
Amazon EC2 container serviceAmazon EC2 container service
Amazon EC2 container service
 
Continuous operations in AWS
Continuous operations in AWSContinuous operations in AWS
Continuous operations in AWS
 
Architecture of NoSQL distributed clusters on AWS
Architecture of NoSQL distributed clusters on AWSArchitecture of NoSQL distributed clusters on AWS
Architecture of NoSQL distributed clusters on AWS
 
Managing users and aws accounts
Managing users and aws accountsManaging users and aws accounts
Managing users and aws accounts
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 

GraphQL backend with AWS AppSync & AWS Lambda

  • 1. © 2019, Amazon Web Services, Inc. or its Affiliates.© 2019, Amazon Web Services, Inc. or its Affiliates. Sergey Pugachev GraphQL backend with AWS AppSync & AWS Lambda Solutions Architect, AWS
  • 2. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Fullstack https://www.flickr.com/photos/ginnerobot/2549674908/
  • 3. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Backend Front end CI/CD https://www.flickr.com/photos/ginnerobot/2549674908/
  • 4. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. No servers to provision or manage Scales with usage Never pay for idle Availability and fault tolerance built in Serverless means…
  • 5. © 2019, Amazon Web Services, Inc. or its Affiliates.
  • 6. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Cloud Services Cloud Less More Compute Virtual Machine EC2 Elastic Beanstalk AWS LambdaFargate Databases MySQL MySQL on EC2 RDS MySQL RDS Aurora Aurora Serverless DynamoDB Storage Storage S3 Messaging ESBs Amazon MQ Kinesis SQS / SNS Analytics Hadoop Hadoop on EC2 EMR Elasticsearch Service Athena
  • 7. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Docker orchestration in the cloud Management Hosting Amazon Elastic Container Service Amazon Elastic Kubernetes Service Amazon EC2 AWS Fargate Image Registry Amazon Elastic Container Registry
  • 8. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Upstream Kubernetes Use standard Kubernetes APIs. Works with community tools. Highly available Built for production workloads, all clusters are highly available. Backed by a 99.9% SLA. Integrated with the AWS ecosystem: VPC Networking, Elastic Load Balancing, IAM Permissions, CloudWatch and more Amazon Elastic Kubernetes Service
  • 9. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Managed by AWS No EC2 Instances to provision, scale or manage Elastic Scale up & down seamlessly. Pay only for what you use Integrated with the AWS ecosystem: VPC Networking, Elastic Load Balancing, IAM Permissions, CloudWatch and more. Run Kubernetes pods or ECS tasks. AWS Fargate
  • 10. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 11. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. {API}
  • 12. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. InternetMobile & web apps Databases & data stores Basic API technology stack Failover Load balancers Web & application servers Message buses Workers ?API backend ?API “server”
  • 13. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS InternetMobile & web apps Databases & data stores Basic API technology stack Failover Load balancers Web & application servers Message buses Workers ?API backend ?API “server”
  • 14. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. InternetMobile & web apps Basic serverless API technology stack AWS Serverless business logic Serverless APIs Databases & data stores Fail over Load balancers Web/application servers Message buses Workers
  • 15. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. /posts /comments /authors REST API posts comments authors GraphQL API What is GraphQL?
  • 16. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Queries MutationsTypes Subscriptions GraphQL schema and operations A query language for APIs . . . and a runtime! type User { id: ID! username: String! firstName: String lastName: String daysActive: Int }
  • 17. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Queries query GetPost { getPost(id: ”1”) { id title } } mutation CreatePost { createPost(title: “Summit”) { id title } } subscription OnCreatePost { onCreatePost { id title } } Mutations Subscriptions A query language for APIs . . .
  • 18. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 19. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 20. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS AppSync Managed serverless GraphQL service Connect to data sources in your account Add data sync, real-time, and offline capabilities for any data source or API GraphQL facade for any AWS service Conflict detection and resolution in the cloud Enterprise security features: IAM, Amazon Cognito, OIDC, API keys
  • 21. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. How does AWS AppSync work? , ,
  • 22. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL data flow in AWS AppSync: Resolvers Request template Response template Data sources 1 2 3 4 5
  • 23. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Pipeline resolvers
  • 24. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Real-time data broadcasting
  • 25. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Real-time subscriptions subscription onCreateMessage { createMessage {…} } WebSocket URL and connection payload Secure WebSocket connection (wss://) AppSync Data Sources AWS AppSync Amazon DynamoDB Amazon Elasticsearch Service AWS Lambda Amazon Aurora HTTP Local (Pub/Sub)
  • 26. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Offline
  • 27. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Polyglot backend data access
  • 28. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 29. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amplify Framework
  • 30. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amplify Framework
  • 31. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amplify Framework ü CLI ü Client libraries (native and JS support) ü Console – Continuous deployment and hosting ü Prebuilt UI components ü Toolchain ü JS framework support
  • 32. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. • Create, update, and delete cloud services • Manage multiple environments • GraphQL Transform • GraphQL Codegen Amplify Framework CLI
  • 33. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Categories Authentication Analytics Interactions (chat bots) API (REST) API (GraphQL) Amplify CLI Serverless functions Storage XR Push notifications Video
  • 34. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. $ amplify add auth $ amplify push $ amplify configure auth $ amplify delete $ amplify codegen add Amplify CLI
  • 35. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. $ amplify add api – # schema.graphql type Post @model { id: ID! title: String! }
  • 36. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. @model Top-level entity; creates DynamoDB table, resolvers, and additional schema (queries, mutations, and subscriptions) for base type @connection Enables relationships between @model types @auth Enables set of authorization rules @searchable Handles streaming the data of an @model object type to Amazon Elasticsearch Service and configures search resolvers @versioned Enables versioning @function Enables adding a Lambda function as a data source –
  • 37. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL Transform: Mix and match data sources type Post { id: ID! content: String description: String ups: Int downs: Int }
  • 38. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL Transform: Mix and match data sources createPost readPost updatePost deletePost type Post @model { id: ID! content: String description: String ups: Int downs: Int }
  • 39. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL Transform: Mix and match data sources mutations queries createPost readPost updatePost deletePost type Post @model @auth(rules: [{allow: owner}]){ id: ID! content: String description: String ups: Int downs: Int }
  • 40. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL Transform: Mix and match data sources searchPosts mutations queries createPost readPost updatePost deletePost type Post @model @auth(rules: [{allow: owner}]) @searchable{ id: ID! content: String description: String ups: Int downs: Int }
  • 41. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL Transform: Mix and match data sources searchPosts mutations queries createPost readPost updatePost deletePost type Post @model @auth(rules: [{allow: owner}]) @searchable{ id: ID! content: String description: String ups: Int downs: Int }
  • 42. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. $ amplify add codegen [--apiId <api-id>] // Will generate GraphQL statements // (queries, mutations, subscriptions)
  • 43. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. $ amplify env add $ amplify env list $ amplify env checkout $ amplify env remove
  • 44. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Multiple environments and team workflow • Git-style interaction and project switching • Share backends between team members or clone for sandbox isolated development User Users
  • 45. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amplify Framework • Connect to and interact with cloud services from web and mobile applications • Preconfigured components for popular front-end libraries Client
  • 46. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Amplify client • Opinionated • Declarative • Client focused • High-level abstractions • Best practices built in • Built with Amplify CLI in mind
  • 47. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Amplify client import { Auth, API, Storage, Analytics, XR } from ‘aws-amplify’ $ npm install aws-amplify
  • 48. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Amplify client import { Auth } from ‘aws-amplify’ Auth.signIn(’myusername’, ‘mypassword’) Auth.signOut() Auth.currentAuthenticatedUser()
  • 49. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Amplify: Native support
  • 50. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Amplify: JS framework support
  • 51. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Higher-order components import {withAuthenticator} from ‘aws-amplify-react’ export default withAuthenticator(App) class App extends Component { // your code goes here
  • 52. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon API Gateway Amazon Pinpoint AWS Lambda AWS AppSync Amazon DynamoDBAmazon Cognito
  • 53. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Deploying a Lambda function with API Gateway 1. Create the Lambda function & API $ amplify add api // chose REST with Express backend
  • 54. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 2. Write code/make changes // amplify/backend/function/<FUNCTION_NAME>/src/app.js app.get(‘/items’, function(req, res) { // new code goes here }) Deploying a Lambda function with API Gateway
  • 55. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. $ amplify push 3. Deploy new API Deploying a Lambda function with API Gateway Amazon API Gateway AWS Lambda
  • 56. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. import { API } from ‘aws-amplify’ API.get(’/items’) .then(data => console.log({ data })) .catch(err => console.log({ err }) 4. Interact with the API Deploying a Lambda function with API Gateway
  • 57. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. $ amplify add auth // choose either default or custom configuration 1. Create the authentication service Adding authentication
  • 58. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. import { Auth } from ‘aws-amplify’ 2. Import the Auth component Adding authentication
  • 59. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Auth.signUp(‘username’, ‘password’, { attributes: { email: ‘jane@doe.com’ } }) Auth.signIn(’myusername’, ‘mypassword’) 3. Implement Auth methods Adding authentication
  • 60. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. $ amplify add api // chose GraphQL 1. Create the GraphQL API Deploying a GraphQL API
  • 61. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. type Todo @model { id: ID! name: String! description: String! completed: Boolean } 2. Define annotated GraphQL schema Deploying a GraphQL API
  • 62. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. $ amplify push 3. Deploy new API Deploying a GraphQL API Amazon Cognito AWS AppSync Amazon DynamoDB
  • 63. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. import { API, GraphqlOperation } from ‘aws-amplify’ import { listTodos } from ‘./src/graphql/queries’ API.graphql(graphqlOperation(listTodos)) .then(data => console.log({ data })) .catch(err => console.log({ err }) 4. Interact with API Deploying a GraphQL API
  • 64. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. $ amplify add analytics $ amplify push 1. Create analytics service Adding analytics Amazon Pinpoint
  • 65. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 2. Import Analytics API Adding analytics import { Analytics } from ‘aws-amplify’
  • 66. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 3. Record events Adding analytics Analytics.record({ name: 'albumVisit’ }) Analytics.record({ name: 'albumVisit', // Attribute values must be strings attributes: { genre: ‘nu-metal', artist: ’RATM’ } })
  • 67. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon API Gateway Amazon Pinpoint AWS Lambda AWS AppSync Amazon DynamoDBAmazon Cognito
  • 68. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS AppSync JS SDK • Offline ready • Built-in helpers for optimistic response, subscriptions • Use with React Apollo / Vue Apollo / Angular Apollo • https://github.com/awslabs/aws-mobile-appsync-sdk-js
  • 69. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 70. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 71. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Fullstack DevOps for web apps • Strong isolation barrier between projects and stages Dedicated AWS accounts for each project and stage (sandbox, staging, prod) • Source code (and history) for each stage readily available Git branching used for the source code for each stage • Minimize version mismatches between front end and backend Front end (e.g., code) and backend (e.g., AWS CloudFormation templates) developed and versioned together in same Git repository • Developers in control Developers deploy front end *and* backend
  • 72. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. DevOps requirements for modern web apps Web app per dev sandbox Test web app Prod web app Isolated backends Shared backend
  • 73. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. DevOps challenges with modern web apps Lots of moving parts complicate the following:
  • 74. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Amplify Console Build, deploy, and host cloud-powered modern web apps Optional deployment of backend resources + fully managed front-end hosting
  • 75. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Use cases Use static site generators like Hugo or Jekyll to publish a blog. SSGs perform faster than traditional websites. Deploy SSGs with free SSL on the AWS Amplify Console. Add dynamic functionality using GraphQL or REST APIs. Use the AWS Amplify Console to deploy your front end and backend in a single workflow. PWAs offer native app-like performance, work offline, support push notifications, and can be updated over the air. Use AWS Amplify to deploy PWAs to mobile devices.
  • 76. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2019, Amazon Web Services, Inc. or its Affiliates. Sergey Pugachev GraphQL backend with AWS AppSync & AWS Lambda Solutions Architect, AWS