Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
20210827 Future Tech Night
Search
Taisei Ito
August 27, 2021
Technology
4.6k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
20210827 Future Tech Night
Taisei Ito
August 27, 2021
More Decks by Taisei Ito
See All by Taisei Ito
Grafana Meetup Japan Vol. 6
kaedemalu
1
900
Cloudflare Meetup Nagano Vol.3
kaedemalu
0
120
Cloudflare Meetup Nagano Vol.2
kaedemalu
0
2.2k
20220214_Future Tech Night
kaedemalu
0
2.6k
20210910_nyle
kaedemalu
0
1.1k
CNDO2021 Open Policy Agent
kaedemalu
1
1.5k
20210210 Terraform meetup ONLINE
kaedemalu
0
710
Future Talk Night 20201118
kaedemalu
0
260
20201114 GCPUG Shonan
kaedemalu
0
520
Other Decks in Technology
See All in Technology
Kiro Crewしか勝たん!?
miu_crescent
PRO
0
190
[DroidKaigi 2026] Making UI specifications visible: Android UI development in the AI agent era supported by Compose Screenshot Testing and galleries
syarihu
0
600
Sony-DroidKaigi2026
sony
1
400
エンタープライズInnerSourceと開発者ポータル
nogikazuma
1
110
Multica × 長期記憶:40個のミニプロジェクト管理
eiei114
1
200
Benchmarking Vector Databases: pgvector vs. LanceDB
tsho
0
150
2026/09/10 Spring_Bootから_Jakarta_EE_MicroProfileへの移行
megascus
0
220
TinyGo 開発サイクルを高速化する:Go で作るエミュレータ入門
zozotech
PRO
1
120
Tab5をRubyで動くパソコンにする
kishima
2
250
AIで仕事のやり方を変える
matsu7874
2
980
薬剤師(ドメインエキスパート)と一緒に育てる薬局向けAIアシスタント
kakehashi
PRO
2
120
AI時代におけるプロダクト横断勉強会の設計
zozotech
PRO
0
170
Featured
See All Featured
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
440
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
BBQ
matthewcrist
89
10k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
A better future with KSS
kneath
240
18k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
490
Crafting Experiences
bethany
1
300
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
310
Navigating Team Friction
lara
192
16k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Transcript
21/8/27 Fri. Taisei Ito GCPのサーバーレスサービスを 利用したWebアプリ開発 Copyright © 2021 by
Future Corporation
Copyright © 2021 by Future Corporation 自己紹介 • 伊藤太斉(たいせい) @kaedemalu
◦ 2019年9月中途入社(社会人4年目) ◦ Technology Innovation Group所属 ◦ 技術ブログの中の人 • 技術領域 ◦ GCP, AWS, IaC(Terraform, Ansible) • コミュニティ ◦ GCPUG Shonan Staff ◦ CloudNative Days Committee
Agenda • 技術選定 • Serverless NEGの利用 • Serverless VPC Access
• ハマったポイント Copyright © 2021 by Future Corporation
概ねの方針 • 運用を楽に(≒管理コストをほぼ0にしたい) ◦ インフラの管理からの開放 ◦ リリースフローからの開放 • セキュリティはしっかり担保したい Copyright
© 2021 by Future Corporation
目指すゴール Copyright © 2021 by Future Corporation
はじめに 1 • 技術選定とアーキテクチャ
アーキテクチャ Copyright © 2021 by Future Corporation
利用サービスの選定 • コンテナですでに開発されている • リクエストが多くない • インフラの管理を極力減らしたい Copyright © 2021
by Future Corporation Compute Compute Engine Cloud Functions Container- Optimized OS Cloud Run Kubernetes Engine App Engine
利用サービスの選定 • コンテナですでに開発されている • リクエストが多くない • インフラの管理を極力減らしたい Copyright © 2021
by Future Corporation Compute Compute Engine Cloud Functions Container- Optimized OS Cloud Run Kubernetes Engine App Engine
利用サービスの選定 • コンテナですでに開発されている • リクエストが多くない • インフラの管理を極力減らしたい Copyright © 2021
by Future Corporation Compute Compute Engine Cloud Functions Container- Optimized OS Cloud Run Kubernetes Engine App Engine
利用サービスの選定 • コンテナですでに開発されている • リクエストが多くない • インフラの管理を極力減らしたい Copyright © 2021
by Future Corporation Compute Compute Engine Cloud Functions Container- Optimized OS Cloud Run Kubernetes Engine App Engine
利用サービスの選定 • コンテナですでに開発されている • リクエストが多くない • インフラの管理を極力減らしたい • アプリは3000ポートでリッスンしたい Copyright
© 2021 by Future Corporation Compute Compute Engine Cloud Functions Container- Optimized OS Cloud Run Kubernetes Engine App Engine
選ばれたのは、Cloud Runでした🎉 Copyright © 2021 by Future Corporation あと、新しいもの使いたいじゃない?
アーキテクチャ Copyright © 2021 by Future Corporation
Serverless NEGの活用 2
Serverless Network Endpoint Group(NEG) • 2020/10にGAになったサーバーレスサービス向けのNEG ◦ eg. App Engine,
Cloud Run, Cloud Functions • サーバーレスサービスを抽象化して、ロードバランサーと 組み合わせることを目的としている Copyright © 2021 by Future Corporation 参考:https://medium.com/google-cloud-jp/serverless-neg-でシステム開発をより柔軟に-4f9cebd2780f
実際に使う Copyright © 2021 by Future Corporation
Cloud Runを設定する • Cloud Runの実際に作成する ◦ コンテナが利用する環境変数 ◦ シークレット ◦
専用のサービスアカウント Copyright © 2021 by Future Corporation
GitOpsしよう • Cloud Runの画面からCloud Buildを作成する Copyright © 2021 by Future
Corporation
NEGの追加まで • 前ページで作成したCloud Run向けのNEGを作成する →LBのバックエンドサービスになる • HTTPSリクエストを受け付けるLBを作成する Copyright © 2021
by Future Corporation
サーバーレスVPCコネクタ 3
サーバーレスVPCコネクタ • サーバーレスサービスがVPCに直接接続するときに利用 ◦ Cloud RunやApp Engineが内部IP経由でアクセスできる (VPC内部のサービスを公開しなくても良い) • 他のVPCと接続(e.g.
VPC Peering)している場合も接続先の リソースまでアクセスできる Copyright © 2021 by Future Corporation 参考:https://cloud.google.com/vpc/docs/serverless-vpc-access?hl=ja
再)アーキテクチャ Copyright © 2021 by Future Corporation
実際に使う Copyright © 2021 by Future Corporation
作成する • /28のサブネットを作成する • サーバーレスVPCコネクタを作成する • コネクタで稼働するインスタンスのスペックを決定する Copyright © 2021
by Future Corporation 参考:https://cloud.google.com/vpc/docs/serverless-vpc-access?hl=ja
作成する Copyright © 2021 by Future Corporation 参考:https://cloud.google.com/vpc/docs/serverless-vpc-access?hl=ja
完成品(?) • 出来上がった!! Copyright © 2021 by Future Corporation
でもこれでは繋がらない Copyright © 2021 by Future Corporation
Shared VPC利用のハマり 4
サービスアカウントにハマる • Cloud Run作成時に「Cloud Runサービスエージェント」の ロールが付けられたサービスアカウントがこっそり作成される e.g.)
[email protected]
• ↑のサービスアカウントをShared
VPCのホストプロジェクトで 「サーバーレスVPCアクセスユーザー」を付与する Copyright © 2021 by Future Corporation 参考:https://cloud.google.com/run/docs/configuring/service-accounts?hl=ja
Cloud Runのエラー Cloud Run error: Container failed to start. Failed
to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information. Copyright © 2021 by Future Corporation 参考:https://cloud.google.com/run/docs/configuring/service-accounts?hl=ja • Runがポートをリッスンできない →あくまで「結果的に」リッスンできないだけ Cloud Loggingを見にいくと原因がしっかり出力されている
まとめ Copyright © 2021 by Future Corporation
完成品! Copyright © 2021 by Future Corporation
おわり Copyright © 2021 by Future Corporation