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
ALBの疎通確認をWebサーバーなしでやる
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
jhashimoto
June 18, 2026
Technology
140
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ALBの疎通確認をWebサーバーなしでやる
JAWS-UG 群馬 #35登壇資料
jhashimoto
June 18, 2026
More Decks by jhashimoto
See All by jhashimoto
SteampipeとExcel Power QueryでAWS構成定義書の作成を自動化する
jhashimoto
0
950
EdgeプロファイルでAWSアカウントを安全に使い分ける
jhashimoto
0
200
初めてのAWS / The first AWS
jhashimoto
0
330
AWS Data Pipelineを本番投入してみた話
jhashimoto
1
1.2k
AWS Lambdaで始めるサーバーレスアーキテクチャ
jhashimoto
0
290
Amazon S3の紹介
jhashimoto
0
310
クラウド最初の一歩
jhashimoto
0
430
Other Decks in Technology
See All in Technology
OpenClawでAzure DevOpsのWiki更新を自動化する - クラウドAIだけでは届かない場所へ
yutakaosada
0
140
生成AIと進める探索的データ分析(2026.10.03 第122回Tokyo.R勉強会)
tatamiya
1
780
プラットフォームを「作る」、 チームに「入り込む」
sansantech
PRO
0
440
セルフサービスのオブザーバビリティ基盤をOpenTelemetryで作る / Building a Self-Service Observability Platform with OpenTelemetry
ymotongpoo
3
500
人にやさしく、AIにやさしく、書き手を選ばないIaCのガードレール再考 / Rethinking IaC Guardrails for Humans and AI Alike
kohbis
5
2k
全社共通データ基盤をつくる。ソニーのDatabricks活用とデータガバナンス設計の裏側
sony
0
290
AI Made Us Faster at Solving the Wrong Problems
marceloancelmo
0
130
Snowflake Horizon Catalog と Apache Iceberg で作る オープンなデータ基盤
kitagawaz
0
380
Swap and Memory Reclaim - Squeezing Out More RAM
ennael
PRO
1
1.5k
React Nativeでの OTA Updateって、 どう説明する?
ichiki1023
0
130
スキルを作る、その前に!複数人で使われるスキルを 作るためのプロセス
junkifurukawa
2
160
個別開発で終わらせない。 現場の課題をプロダクトの強さに変える StockmarkのFDE
ktkrhr
0
530
Featured
See All Featured
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
720
The Cult of Friendly URLs
andyhume
79
7k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
58k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
570
Bash Introduction
62gerente
615
220k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
550
How to Ace a Technical Interview
jacobian
280
24k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.9k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
Transcript
ALB の疎通確認をWeb サーバーなしでやる JAWS-UG 群馬 #35 10 分LT JAWS-UG 群馬
#35 1 / 14
発表者 橋本淳一 フリーランスのクラウドエンジニア 最近都内から栃木に引っ越しました 現在の仕事はEC サイトのインフラ運用 ポートフォリオ: https://lapras.com/public/jhashimoto JAWS-UG 群馬
#35 2 / 14
前提 インフラ担当とアプリ担当が別れている インフラ担当: ALB とEC2 の構築 アプリ担当: EC2 のOS より上のレイヤーを担当
インフラ担当としてALB -> EC2 の疎通確認をして引き渡したい JAWS-UG 群馬 #35 3 / 14
構成 以下の経路を想定。 クライアント │ HTTPS:443 ▼ ALB + ACM │
HTTP:8080 ▼ ターゲットグループ │ HTTP:8080 ▼ EC2インスタンス JAWS-UG 群馬 #35 4 / 14
目的 ALB にリクエストし、ターゲットからのレスポンスが返ることを確認したい ただし、Apache/Nginx 等のミドルウェアはインストールしたくない(インフラの 責務ではないから) テスト例: curl https://my-domain.com/ #
OK JAWS-UG 群馬 #35 5 / 14
問題 Web サーバーのミドルウェアがないとレスポンスが返せない ターゲットグループのヘルスチェックをパスする必要がある 例: ステータス200 を3 回連続で返したら、Healthy JAWS-UG 群馬
#35 6 / 14
案1: nc コマンド (1/2) nc コマンドのシンプルな使い方。 # サーバーで待ち受けておく nc -lk
8080 # クライアントからリクエスト echo "OK" | nc -q 0 {サーバーIP} 8080 -l : Listen モード -k : Keep inbound sockets open for multiple connects. 切断後も同じポートで次の 接続を待ち続ける -q 0 : quit after EOF on stdin and delay of secs. STDIN で EOF 後すぐに閉じる JAWS-UG 群馬 #35 7 / 14
案1: nc コマンド (2/2) 以下をターゲットで実行しておくと、ヘルスチェックをパスでき、リクエストに対し てレスポンスを返せる。 8080 でリッスンし、リクエストに対して200 を返す レスポンスを返した後も、リッスンが継続される
while true; do echo -e "HTTP/1.1 200 OK\r\nContent-Length: 3\r\n\r\nOK\n" | nc -l 8080 done # 以下のレスポンスを返す # HTTP/1.1 200 OK # Content-Length: 3 # # OK # JAWS-UG 群馬 #35 8 / 14
案2: Python でWeb サーバーを立てる (1/2) Python の組み込みHTTP サーバーなら、ワンライナーでHTTP サーバーを起動できる。 JAWS-UG
群馬 #35 9 / 14
案2: Python でWeb サーバーを立てる (2/2) PORT=8080 python3 -c " import
http.server, socketserver, os PORT = int(os.environ['PORT']) class Handler(http.server.BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) self.end_headers() self.wfile.write(b'OK\n') def log_message(self, format, *args): pass # TCPサーバの終了直後にもう一度起動したときの「Address already in use」エラーを避ける # https://www.geekpage.jp/programming/winsock/so_reuseaddr.php socketserver.TCPServer.allow_reuse_address = True with socketserver.TCPServer(('', PORT), Handler) as httpd: print(f'Listening on port {PORT}') try: httpd.serve_forever() # Ctrl + C による KeyboardInterruptを抑制 except KeyboardInterrupt: pass " JAWS-UG 群馬 #35 10 / 14
補足: コマンド実行後にPORT 変数は参照されるか? A: 参照されないので、環境を汚さない コマンドの前に KEY=VALUE の形式で書くことを「パラメータ代入」と呼び(シェルの 機能) 、そのコマンドの実行中だけ環境変数として参照できる。
実験結果: $ PORT=8080 env | grep PORT # PORTを環境変数として参照できる PORT=8080 $ echo ${PORT} # コマンド実行後のシェル自身にはPORTが残っていない(何も出力されない) $ 参考: https://astro.uni-bonn.de/~sysstw/CompMan/gnu/bashref.html#TOC49 JAWS-UG 群馬 #35 11 / 14
リクエストしてみる ローカルホストにリクエストする。 curl http://localhost:8080/my-health-check-path # OK ターゲットのステータスが Healthy になったらドメインに対してリクエストする。 curl
https://my-domain.com/ # OK 確認が終わったら、ターミナルで Ctrl + C して HTTP サーバーを停止する。 JAWS-UG 群馬 #35 12 / 14
まとめ Web サーバーを構成していないターゲットでも、nc コマンドやPython の組み込み HTTP サーバーで疎通確認ができる nc コマンドは手軽だが、ヘルスチェックを通すにはHTTP レスポンスを自分で組み
立てる必要がある Python の組み込みHTTP サーバーなら、ワンライナーでもHTTP サーバーを起動でき る インフラ担当の責任範囲内(ミドルウェア追加なし)で、ALB -> EC2 の疎通確認 が完結できる JAWS-UG 群馬 #35 13 / 14
ありがとうございました JAWS-UG 群馬 #35 14 / 14