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
810
Cloudflare Meetup Nagano Vol.3
kaedemalu
0
110
Cloudflare Meetup Nagano Vol.2
kaedemalu
0
2.1k
20220214_Future Tech Night
kaedemalu
0
2.5k
20210910_nyle
kaedemalu
0
1.1k
CNDO2021 Open Policy Agent
kaedemalu
1
1.5k
20210210 Terraform meetup ONLINE
kaedemalu
0
700
Future Talk Night 20201118
kaedemalu
0
250
20201114 GCPUG Shonan
kaedemalu
0
510
Other Decks in Technology
See All in Technology
Databricks における 生成AIガバナンスの実践
taka_aki
1
370
Rancherの紹介&Update情報(RancherJP Online Meetup #09)
yoshiyuki_kono
0
140
ブロックチェーン / Blockchain
ks91
PRO
0
120
価格.comをAI駆動で全面刷新する ー 30年分の技術的負債を返し、次の30年の土台をつくる ー / AI Engineering Summit Tokyo 2026
tkyowa
53
58k
データ基盤をDataformで整えた話 〜 開発環境を添えて 〜
takapy
0
130
MIERUNE JCT 発表資料「宇宙から伊能忠敬ごっこ」
syuchimu
0
200
中期計画、2回作ってみた ~業務委託と正社員、両方の視点から~
demaecan
1
560
生成 AI × MCP で切り拓く次世代 SRE!自律型運用への挑戦と開発者体験の進化
_awache
0
180
LLMにもCAP定理があるという話
harukasakihara
0
280
運用を見据えたAIエージェント設計実践
amacbee
1
3.4k
あなたの AI ワークスペースに、 専門コーダーを連れてくる - Amazon Quick Desktop 最新情報
kawaji_scratch
1
120
Snowflakeと仲良くなる第一歩
coco_se
4
340
Featured
See All Featured
Game over? The fight for quality and originality in the time of robots
wayneb77
1
190
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
Optimising Largest Contentful Paint
csswizardry
37
3.7k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
210
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
KATA
mclloyd
PRO
35
15k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
290
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
160
Claude Code のすすめ
schroneko
67
230k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
190
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