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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
820
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
脱SaaS!FDEを支えるプロビジョニングと分離設計
knih
0
240
人材育成分科会.pdf
_awache
4
290
2026TECHFRESH畢業分享會 - Lightning Talk - 打造精準高效的 MCP 設計模式與測試實務
line_developers_tw
PRO
0
1.2k
いまさら聞けない「仕様駆動開発入門」 〜AI活用時代の開発プロセスを考える〜
findy_eventslides
2
160
気軽に使える"情報のハブ"としてのNotion活用 〜フロー情報の集積点 と、 Claude Code × Notion AI〜
syucream
1
150
作って終わりにしない タイミーのセマンティックレイヤー育成の現在地
chanyou0311
4
2.5k
AI時代のコスト管理を考えよう〜明日から使える実践AWSノウハウ~
yoshimi0227
0
220
【Cyber-sec+】経営層を"動かす"ための考え方
hssh2_bin
0
190
【セミナー資料】Claude Code をセキュアに使うための考え方と設定の勘どころ / Claude Code Webinar 20260616
masahirokawahara
2
410
Chainlitで作るお手軽チャットUI
ynt0485
0
270
攻撃者視点で考えるDetection Engineering
cryptopeg
3
2k
AIチャット検索改善の3週間
kworkdev
PRO
2
130
Featured
See All Featured
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
290
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
210
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
610
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Automating Front-end Workflow
addyosmani
1370
210k
BBQ
matthewcrist
89
10k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Chasing Engaging Ingredients in Design
codingconduct
0
220
Statistics for Hackers
jakevdp
799
230k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
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