Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
AWS CDK × Reactでliffをつくる
Search
tokku5552
June 29, 2022
Programming
610
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
AWS CDK × Reactでliffをつくる
AWS CDK × Reactでliffをつくる
tokku5552
June 29, 2022
More Decks by tokku5552
See All by tokku5552
他責思考で考える、EMとICの本音
tokku5552
1
200
Google CloudとAWSのコンテナ実行環境比較
tokku5552
0
270
高スループット・低レイテンシを実現する技術
tokku5552
3
17k
AWS CDKのススメ
tokku5552
1
580
Messaging APIのメッセージオブジェクトを検証できるChrome拡張機能を作った話
tokku5552
1
180
FlutterにLINEログインを仕込んで通知メッセージを送る
tokku5552
2
1.1k
Flutterで単体テストを行う方法とGitHub Actionsを使った自動化
tokku5552
1
160
ネットワーク基礎 - WEBページが表示されるまで
tokku5552
1
340
インフラエンジニアのお仕事(オンプレ)
tokku5552
0
180
Other Decks in Programming
See All in Programming
Snowflakeで業務アプリを作ろう。 Snowflakeのアプリ機能解説&実践ガイド
ayumu_yamaguchi
2
310
スマート反転とウェブアクセシビリティ
camiha
0
220
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
330
手動確認はもう限界 〜XCUITestでCustom URL Schemeの遷移を起動種別ごとに自動テストする〜 / Testing Custom URL Schemes with XCUITest
otouto
0
360
MCP Appsでつくるチャット駆動な地図アプリ
nakamori1024
0
110
SONY CISC-NEWS NWS-1750 + NWB-225 フレームバッファの NetBSD/news68k ドライバ実装 / OSC2026Hiroshima
tsutsui
0
150
Webの地図
yosuke_furukawa
PRO
6
4.9k
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.3k
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
390
すこし踏み込む CancellationToken
htkym
2
1.3k
iOSDC2026登壇資料.pdf
riofujimon
0
200
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
220
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Statistics for Hackers
jakevdp
799
230k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
3
4.3k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
58k
Become a Pro
speakerdeck
PRO
31
6.3k
WENDY [Excerpt]
tessaabrams
14
39k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
540
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
440
Transcript
AWS CDK x ReactでLIFFアプリ LINE Monthly LT #3 2022/6/29
自己紹介 とっく(@tokkuu) • ミロゴス株式会社のエンジニア • php/python/TypeScript • AWS周り 3-tierからサーバレスまで •
元々はSIerのインフラエンジニア • LINE API歴は半年くらい 2
はじめに • 前提知識 ◦ AWSリソース(CloudFront/S3) ◦ CloudFormationの概要(json or yamlでテンプレートを書いてスタック作成 )
◦ LINE Developersコンソールの操作・liffについて • このスライドの元ネタ ◦ https://zenn.dev/tokku5552/articles/liff-cdk-create • 参考 ◦ https://developers.line.biz/ja/docs/liff/ 3
AWS CDKとは • AWSが提供するIaC(Infrastructure as Code)ツールの一つ ◦ CloudFormationのテンプレートを作成し、デプロイしてくれるツール • CloudFormationが対応しているものは対応していると考えて良い
◦ サーバーレスでないリソースも作れる • 特徴はjsonやyamlではなく、プログラミング言語でインフラを記述できるところ。 ◦ IDEの補完などの補助機能が使える。画像は TypeScriptの場合の例 4
AWS CDK×Reactでのliffのはじめかた
構成 • AWS CDKがCloudFormationの スタックを作成 • CloudFrontとS3バケットが 作成される • liffのコードもビルドしたものをcdkで
デプロイ 6 ・リポジトリ https://github.com/tokku5552/liff-cdk-sample
AWS CDK × Reactでのliffのはじめかた • cdk init ◦ cdkの雛形が作られる ◦
サーバーレスな構成でアプリケーションコードと一緒に管理するときは cdkのプロジェクト構成がトップにあったほうがやりやすい。 • create-liff-app ◦ プロジェクトルートで実行するが、途中で聞かれる project nameのフォルダが 勝手に切られ、その下に作成される。(好都合) • ここまででyarn devでliffが起動&cdk deployでデプロイできる ◦ cdkはstackを定義していないので、 liffがデプロイされるわけではないが ローカルの環境構築はこれだけ 7
フォルダ構成 . ├── README.md ├── bin/ │ └── liff-cdk-sample.ts ├──
cdk.json ├── cdk.out/ ├── lib/ │ └── liff-cdk-sample-stack.ts ├── liff-app/ │ ├── index.html │ ├── package.json │ ├── src/ │ │ ├── App.css │ │ ├── App.tsx │ │ ├── favicon.ico │ │ ├── main.tsx │ │ └── vite-env.d.ts │ ├── vite.config.ts ├── package.json └── tsconfig.json 8 • cdk init でbin,lib,cdk.jsonなどが作られる ◦ binがcdkコマンドのエントリポイント ◦ libの下にスタックのコードを置いていく • create-liff-appではproject nameで指定した フォルダが作られる ◦ その下はviteというビルドツールで Reactの雛形の構 成が生成されている ◦ cd liff-app && yarn devでliffアプリがローカルで起 動する
stackの記述 export class LiffCdkSampleStack extends Stack { constructor(scope: Construct, id:
string, props?: StackProps) { super(scope, id, props); const liffAppBucket = new s3.Bucket(this, 'LiffAppBucket', { websiteIndexDocument: 'index.html' }); const liffAppDistribution = new cloudfront.CloudFrontWebDistribution(this, 'LiffAppDistribution', { originConfigs: [ { s3OriginSource: { s3BucketSource: liffAppBucket, originAccessIdentity: liffAppIdentity }, behaviors: [{isDefaultBehavior: true}] } ], }) Stackを継承したclassの中の constructorに作りたいリソースを 書いていく 前段で作成したS3バケットを変数に入 れておき、CloudFrontのオリジンに渡し ている。これで連携可能 9 ※途中省略しています
デプロイ npx cdk deploy CloudFormationのスタックが作られる 10
liffアプリ起動🎉 11
まとめ • liffアプリをAWS上で、Reactで作る場合はAWS CDKがおすすめ • CDKならホスティングのみならず、API Gateway + Lambda +
DynamoDBみたいな 構成もかなり短く記述できる • とにかくAWS CDKオススメです!!!! ご清聴ありがとうございました