1 of 49

Introduction to Serverless Computing and AWS Lambda

Fon Nkwenti

Sr. Serverless Developer�Serverless Guru

2 of 49

Agenda

  1. Intro to Flutter and AWS Amplify
  2. Set up AWS Amplify with a Flutter App
  3. Implement Secure Authentication
  4. Create and Deploy APIs
  5. Enable File Storage and Management
  6. Deploying backend to production

3 of 49

Name: Yunwen Eric

Company: Neero CM

Role: Mobile Developer

Communities: AWS User Group Douala 🇨🇲,GDG Bamenda

@yunweneric

@yunweneric

About Me

© 2020, PMazon Web Services, Inc. or its affiliates. All rights reserved.

4 of 49

1.0

Introduction to Flutter and Amplify

© 2020, PMazon Web Services, Inc. or its affiliates. All rights reserved.

5 of 49

Flutter is an open-source UI toolkit by Google for building natively compiled apps for mobile, web, and desktop from a single codebase. It uses the Dart programming language.

What is a Flutter?

6 of 49

A backend solution where infrastructure management is abstracted away, allowing developers to focus on code.

About Serverless

7 of 49

Serverless VS traditional architecture.

Aspect

Serverless

Traditional

Infrastructure Management

No need to manage servers, handled by cloud provider

Servers must be provisioned, managed, and maintained manually

Scalability

Automatic, scales up/down based on demand

Manual scaling or requires load balancing and server management

Cost

Pay-per-use, charged based on execution time and resources

Fixed cost based on server capacity, regardless of usage

Deployment Speed

Fast deployment, often with minimal configuration

Slower, requires configuring servers and infrastructure

Use Case

Ideal for event-driven, short-lived, or stateless applications

Suited for long-running applications or those needing full control over resources

Vendor Dependency

High vendor lock-in with cloud providers (AWS, Azure, etc.)

More flexibility to switch between providers or self-hosted options

8 of 49

9 of 49

2.0

Set up AWS Amplify with a Flutter App

© 2020, PMazon Web Services, Inc. or its affiliates. All rights reserved.

10 of 49

Prerequisite

  • Node.js v18.17 or later
  • npm v9 or later
  • git v2.14.1 or later
  • You will also need to create an AWS Account. Note that AWS Amplify is part of the AWS Free Tier.
  • Configure your AWS account to use with Amplify instructions.
  • A stable version of Flutter.

11 of 49

Getting Started

12 of 49

Backend generated in tsc

13 of 49

Platform setup and constraints

14 of 49

Local Development setup with sandboxes

15 of 49

Break☕️

© 2020, PMazon Web Services, Inc. or its affiliates. All rights reserved.

16 of 49

3.0

Implement Secure Authentication

© 2020, PMazon Web Services, Inc. or its affiliates. All rights reserved.

17 of 49

Key Concepts of Authentication & Authorization

  • Authentication (AuthN): Validates who you are and can be Managed by an Identity Provider (IdP) like Google, Apple, or Amazon.
  • Authorization (AuthZ): Validates what you can access and is done via tokens, custom logic, or signed requests.

18 of 49

Amazon Cognito + Amplify Integration

  • User Pools: Manages user authentication and account recovery.
  • Identity Pools: Authorizes access to AWS services.
  • Interfaces with Cognito for authentication and AWS resource authorization.
  • Supports external IdPs (e.g., Google, Facebook).
  • Authorization (AuthZ): Validates what you can access and is done via tokens, custom logic, or signed requests.

19 of 49

Amazon Cognito + Amplify Integration

Amazon Cognito

Amazon Cognito Federated Identities or Identity Pools

Amazon Cognito User Pools

20 of 49

Amazon Cognito user pools

Amazon Cognito User Pools is a full-featured user directory service to handle user registration, authentication, and account recovery

21 of 49

Amazon Cognito Federated Identities or Identity Pools

  • Temporary Credentials: Identity pools provide AWS credentials for guest and signed-in users with configurable permissions.
  • Multiple Providers: Supports OAuth (Google, Apple), SAML/OIDC, and custom authentication.
  • Granular Access: Enables fine-tuned access control with IAM policies and session tags.

22 of 49

DEMO #1

23 of 49

Before you build

Amazon Cognito can be customized based on your security strategy for authentication. However, some initial configuration options cannot be changed after the backend resources are configured:

Find Rules Here

https://docs.amplify.aws/flutter/build-a-backend/auth/concepts/#before-you-build

24 of 49

EMAIL AUTH

25 of 49

Email Auth Backend Setup

26 of 49

Deploy Sandbox

27 of 49

Flutter Dependencies

28 of 49

Flutter Dependencies

29 of 49

Initialize the config generated

30 of 49

Using Authenticator UI Library

31 of 49

Using Client library

Amplify provides a client library that enables you to interact with backend resources such as Amplify Auth.

  • Sign-up
  • Sign-in
  • Sign-out

32 of 49

PHONE AUTH

33 of 49

34 of 49

Deploy Sandbox

35 of 49

Why does sandbox deployment fails?

36 of 49

Break☕️

© 2020, PMazon Web Services, Inc. or its affiliates. All rights reserved.

37 of 49

4.0

Create and Deploy APIs

© 2020, PMazon Web Services, Inc. or its affiliates. All rights reserved.

38 of 49

Create a schema and export resource

  • Create a schema(creates DynamoDB tables, Implements Mutations and Queries)
  • Add authorizations to manage resources to the schema
  • Define defineData with authorization methods
  • Deploy changes to sanbox

39 of 49

Connect to flutter frontend

  • Add amplify_api dependency
  • Generate the GraphQL client code
  • Import generated models
  • Play around (CRUDS on Model)

40 of 49

DEMO

41 of 49

SETUP

42 of 49

Explorations

  • CRUDS
  • Streams
  • Interceptors
  • Working with files/attachments

43 of 49

5.0

Deploying backend to production

© 2020, PMazon Web Services, Inc. or its affiliates. All rights reserved.

44 of 49

Amplify.yml

The amplify.yml file is a configuration file used in AWS Amplify to define custom build and deployment processes for both the backend and frontend of your application. It specifies the phases for building, caching, and deploying your application.

45 of 49

46 of 49

Backend CI

47 of 49

Flutter Local CI

48 of 49

What is wrong with local Builds?

  • Uploading heavy artifacts
  • Issues with .gitignore
  • Adding dummy files to source control

49 of 49

Thank You

Let’s connect

@yunweneric

@yunweneric

© 2020, PMazon Web Services, Inc. or its affiliates. All rights reserved.