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
0
4.5k
20210827 Future Tech Night
Taisei Ito
August 27, 2021
Tweet
Share
More Decks by Taisei Ito
See All by Taisei Ito
Grafana Meetup Japan Vol. 6
kaedemalu
1
720
Cloudflare Meetup Nagano Vol.3
kaedemalu
0
99
Cloudflare Meetup Nagano Vol.2
kaedemalu
0
1.9k
20220214_Future Tech Night
kaedemalu
0
2.5k
20210910_nyle
kaedemalu
0
1k
CNDO2021 Open Policy Agent
kaedemalu
1
1.4k
20210210 Terraform meetup ONLINE
kaedemalu
0
690
Future Talk Night 20201118
kaedemalu
0
240
20201114 GCPUG Shonan
kaedemalu
0
480
Other Decks in Technology
See All in Technology
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
44k
ブラックボックス観測に基づくAI支援のプロトコルのリバースエンジニアリングと再現~AIを用いたリバースエンジニアリング~ @ SECCON 14 電脳会議 / Reverse Engineering and Reproduction of an AI-Assisted Protocol Based on Black-Box Observation @ SECCON 14 DENNO-KAIGI
chibiegg
0
140
Digitization部 紹介資料
sansan33
PRO
1
7k
AI Agentにおける評価指標とAgent GPA
tsho
1
300
Windows ネットワークを再確認する
murachiakira
PRO
0
270
生成AIの利用とセキュリティ /gen-ai-and-security
mizutani
1
1.2k
Ultra Ethernet (UEC) v1.0 仕様概説
markunet
3
200
開発組織の課題解決を加速するための権限委譲 -する側、される側としての向き合い方-
daitasu
5
250
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
3k
組織のSREを推進するためのPlatform EngineeringとEKS / Platform Engineering and EKS to drive SRE in your organization
chmikata
0
180
「データとの対話」の現在地と未来
kobakou
0
1.3k
Oracle Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
4
1.1k
Featured
See All Featured
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.7k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
310
WCS-LA-2024
lcolladotor
0
470
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
290
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
460
The Limits of Empathy - UXLibs8
cassininazir
1
240
My Coaching Mixtape
mlcsv
0
64
RailsConf 2023
tenderlove
30
1.4k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
450
How Software Deployment tools have changed in the past 20 years
geshan
0
32k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
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