Amplify

Tim Lavreniuk

(feedback)

Me

  • AWS Certified Solution Architect
  • 10+ years in software development
  • 5 years with Flutter
  • GDG Hannover co-organizer
  • Speaking at conferences

My amplify projects

  • Online Education platform (Flutter Web, 2 years)
  • Kid educational apps (Flutter, 2 months)
  • News app pet project (Flutter, 2 months)

Why?

AWS has over 200 fully featured services

Amplify sandbox - amazing

GraphQL transformer - killer feature

Scaling

AWS Amplify, Amplify Studio and Amplify CLI

  • Hosting - only AWS Amplify
  • Functions - only CLI
  • Auth hooks - only CLI

Client side

Data store

  • Cool idea
  • Cant imagine how to use it in projects more complex than a todo list

GraphQL API requests

  • With Amplify codegen schemas
  • With custom schema generation

Amplify codegen schemas

  • clean, no additional libraries/files
  • graphql request without validation
  • only one model will be parsed per request

Custom schema generation

amplify pull without backend editing - doesn't work

when you want to split amplify backend and client app

Auth with migration lambdas

Lambdas

No typescript support

rollup.config.js

import commonjs from '@rollup/plugin-commonjs';
import typescript from 'rollup-plugin-typescript2';
import autoExternal from 'rollup-plugin-auto-external';
import json from '@rollup/plugin-json';
import path from "path";

export default {
    input: 'index.ts',
    output: {
        dir: '.',
        format: 'cjs'
    },
    plugins: [ autoExternal({
        builtins: true,
        dependencies: true,
        packagePath: path.resolve('./package.json'),
        peerDependencies: false,
    }), json(), commonjs(), typescript()],
};

Local development

Lambda layers doesn't work

Another lambda invoke doesn't work

20+ lambdas - poor performance

Auth hooks

DynamoDB triggers

DB operations

1) Use graphql api (easy, slow)

2) Write your own CRUD methods for each table

It was amazing to have utilities like DataStore but for DB table manipulation directly

AWS SDK v3 usage

{
  "Role": {
    "Fn::GetAtt": [
      "LambdaExecutionRole",
      "Arn"
    ]
  },
  "Runtime": "nodejs18.x",
  "Layers": [],
  "Timeout": 25
}

NO possibility to select default version of nodejs for lambdas

Working with API

Amplify studio - mostly unusable

It's amazing, until..

Content screen also doesn't work

no types for graphql directives

# https://docs.amplify.aws/cli-legacy/graphql-transformer/model/
directive @model(
    queries: ModelQueryMap
    mutations: ModelMutationMap
    subscriptions: ModelSubscriptionMap
    timestamps: TimestampConfiguration
) repeatable on OBJECT
input ModelMutationMap {
    create: String
    update: String
    delete: String
}
input ModelQueryMap {
    get: String
    list: String
}
input ModelSubscriptionMap {
    onCreate: [String]
    onUpdate: [String]
    onDelete: [String]
    level: ModelSubscriptionLevel
}
enum ModelSubscriptionLevel {
    off
    public
    on
}

n+1 problem

BatchInvoke is limited

File storage

User need additional knowledge about Bucket policies to make a public bucket

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "MakeItPublic",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::some-bucket-prod/public/*"
        }
    ]
}

Amplify UI

No 2 amplify's hosting for front end at the same time

Additional features

Documentation

Amplify documentation is cool, but

AWS Documentation

Image resizer

Emails

Sometimes push doesnt work

  • Cognito additional params are immutable
  • Changing DynamoDB indexes in graphql @model

one way to fix - full project recreation

shared files for lambdas

to manage cloud (much faster that CDK)

to us typescript in lambdas

amplif-pros-and-cons

By Timofey Lavrenyuk

amplif-pros-and-cons

  • 110