AWS Amplify Gen2 ― CDK と Sandbox で快適フルスタック開発 ―

508 Views

August 30, 25

スライド概要

2025年8月28日に開催した社内イベント「AWSランチセッション第9回」の発表資料です。

コードベースで生まれ変わったAmplify Gen2の素晴らしさを紹介しています!
従来の煩雑な対話型CLIが合わずAmplifyとお別れした方にこそ、柔軟かつ快適になったGen2でぜひAmplifyを再評価してください!

profile-image

SFとコンピュータが好き

シェア

またはPlayer版

埋め込む »CMSなどでJSが使えない場合

ダウンロード

関連スライド

各ページのテキスト
1.

2025-08-28 AWSランチセッション 第9回 AWS Amplify Gen2 ― CDK と Sandbox で快適フルスタック開発 ― 山崎 拓也

2.

山崎 拓也 所属: SIer 仕事: • AWSを使ったシステム開発など • アプリとインフラ両方 好き: 低レイヤ、SF、AWS AWS関連: • 2024~2025 Japan AWS Top Engineer • 2022~2025 Japan All AWS Certifications Engineer

3.

AWS Amplify はアプリを素早く構築・デプロイするためのサービス • フロントエンドとバックエンドを一元管理 • ユーザー認証やデータ管理、関数なども素早く構築可能

4.

Amplify (Gen1) の独自CLIベースなところが苦手でした・・・ • 質問や選択肢が多く煩雑な対話型CLI • バックエンドリソースが把握しづらい • 特定の設定変更が難しい(どの質問で変更できるんだっけ?等) ユーザー認証用バックエンドリソースを作成する様子 $ amplify add auth Using service: Cognito, provided by: awscloudformation The current configured provider is Amazon Cognito. Do you want to use the default authentication and security configuration? Manual configuration Select the authentication/authorization services that you want to use: User Sign-Up, Sign-In, connected with AWS IAM controls (Enables per-user Storage features for images or other content, Analytics, and more) Provide a friendly name for your resource that will be used to label this category in the project: gen1demo Enter a name for your identity pool. gen1demo_identitypool Allow unauthenticated logins? (Provides scoped down permissions that you can control via AWS IAM) No Do you want to enable 3rd party authentication providers in your identity pool? No Provide a name for your user pool: gen1demo_userpool Warning: you will not be able to edit these selections. How do you want users to be able to sign in? Email Do you want to add User Pool Groups? No Do you want to add an admin queries API? No Multifactor authentication (MFA) user login options: ON (Required for all logins, can not be enabled later) For user login, select the MFA types: Time-Based One-Time Password (TOTP) Specify an SMS authentication message: Your authentication code is {####} ...

5.

Amplify (Gen1) の独自CLIベースなところが苦手でした • 質問や選択肢が多く煩雑な対話型CLI • バックエンドリソースが把握しづらい • 特定の設定変更が難しい(どの質問で変更できるんだっけ?等) ユーザー認証用バックエンドリソースを作成する様子 2024年5月に AWS Amplify Gen2 がリリースされました! $ amplify add auth Using service: Cognito, provided by: awscloudformation The current configured provider is Amazon Cognito. Do you want to use the default authentication and security configuration? Manual configuration Select the authentication/authorization services that you want to use: User Sign-Up, Sign-In, connected with AWS IAM controls (Enables per-user Storage features for images or other content, Analytics, and more) Provide a friendly name for your resource that will be used to label this category in the project: gen1demo Enter a name for your identity pool. gen1demo_identitypool Allow unauthenticated logins? (Provides scoped down permissions that you can control via AWS IAM) No Do you want to enable 3rd party authentication providers in your identity pool? No Provide a name for your user pool: gen1demo_userpool Warning: you will not be able to edit these selections. How do you want users to be able to sign in? Email Do you want to add User Pool Groups? No Do you want to add an admin queries API? No Multifactor authentication (MFA) user login options: ON (Required for all logins, can not be enabled later) For user login, select the MFA types: Time-Based One-Time Password (TOTP) Specify an SMS authentication message: Your authentication code is {####} ...

6.

Amplify Gen2 でコードベースとなり、フルスタック開発が快適に! • バックエンドをAmplify用ライブラリとCDKコードで定義 • マネージドCI/CDによりフロントエンドもバックエンドも自動デプロイ • Gen1のCLIベースが合わずAmplifyとお別れした方に、ぜひ試してほしいです Amplify Gen1 Amplify Gen2

7.
[beta]
CDKによりAmplifyの機能を超えた柔軟性を提供
• あらゆるAWSサービスや機能をバックエンドとして定義可能
• Amplifyのバックエンド定義と同じ場所でCDKによるリソース定義が可能
• 例えば、Step Functionsワークフローを一緒に定義できる
const backend = defineBackend({
auth,
data,
});
const customResources = backend.createStack('custom-resources');

// Passステート定義
const helloPass = new sfn.Pass(customResources, 'HelloPass', {
comment: 'Hello step',
result: sfn.Result.fromString('Hello'),
resultPath: '$.helloResult',
});
// ワークフロー定義
new sfn.StateMachine(customResources, 'MyStateMachine', {
definition: helloPass,
stateMachineName: 'AmplifyGen2ExampleStateMachine',
logs: { destination: logGroup, },
});

8.
[beta]
const backend = defineBackend({
auth,
data,
});
const customResources = backend.createStack('custom-resources');

// Passステート定義
const helloPass = new sfn.Pass(customResources, 'HelloPass', {
comment: 'Hello step',
result: sfn.Result.fromString('Hello'),
resultPath: '$.helloResult',
});
// ワークフロー定義
new sfn.StateMachine(customResources, 'MyStateMachine', {
definition: helloPass,
stateMachineName: 'AmplifyGen2ExampleStateMachine',
logs: { destination: logGroup, },
});

9.

開発者ごとのCloud Sandboxにより開発を高速化 • $ npx ampx sandbox でAWS上に開発用バックエンドリソースをデプロイ可能 • コマンド実行後はコードの変更を検知し、自動でデプロイする • クライアントアプリもローカルで実行しておく • Sandboxにより検証やテストのトライ&エラーを高速化できる

10.

まとめ • コードベースになったAmplify Gen2で、バックエンドを明確かつ扱いやすく 管理 • CDKでAmplifyの枠を超え、あらゆるAWSサービスをバックエンドに定義 • Cloud Sandboxで高速かつ効率的に開発可能 • Gen2になりAmplifyを好きになれました

11.

ご清聴ありがとうございました。