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
GitHub ActionsとAWSをOIDC認証で連携する
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Kazuhiro Seo
April 26, 2025
Technology
1
180
GitHub ActionsとAWSをOIDC認証で連携する
GitHub ActionsとAWSをOIDC認証で連携する
Kazuhiro Seo
April 26, 2025
Tweet
Share
More Decks by Kazuhiro Seo
See All by Kazuhiro Seo
Gradleとちょっと仲良くなろう
kazuhiro1982
0
97
JavaとWebAssembly
kazuhiro1982
0
120
SpringBoot 3.0 のNative Imageを試してみた
kazuhiro1982
0
430
セッションデータの管理にSpring Sessionを利用する
kazuhiro1982
0
3.1k
AWSのLake Formation Governed Tablesを触ってみた
kazuhiro1982
0
420
VS CodeとRemote Containerで開発環境もコード管理しよう
kazuhiro1982
1
730
SpringBootをコンテナで動かしてみる
kazuhiro1982
0
410
Serverless FrameworkでWebサイトの更新を検知して通知する
kazuhiro1982
0
510
Other Decks in Technology
See All in Technology
Oracle Cloud Infrastructure:2026年3月度サービス・アップデート
oracle4engineer
PRO
0
130
スケールアップ企業でQA組織が機能し続けるための組織設計と仕組み〜ボトムアップとトップダウンを両輪としたアプローチ〜
qa
0
360
20260323_データ分析基盤でGeminiを使う話
1210yuichi0
0
190
MCPで決済に楽にする
mu7889yoon
0
150
出版記念イベントin大阪「書籍紹介&私がよく使うMCPサーバー3選と社内で安全に活用する方法」
kintotechdev
0
100
AI時代のIssue駆動開発のススメ
moongift
PRO
0
280
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
3
2k
Amazon Qはアマコネで頑張っています〜 Amazon Q in Connectについて〜
yama3133
1
150
AIエージェント×GitHubで実現するQAナレッジの資産化と業務活用 / QA Knowledge as Assets with AI Agents & GitHub
tknw_hitsuji
0
270
夢の無限スパゲッティ製造機 #phperkaigi
o0h
PRO
0
390
やさしいとこから始めるGitHubリポジトリのセキュリティ
tsubakimoto_s
3
2k
なぜarray_firstとarray_lastは採用、 array_value_firstとarray_value_lastは 見送りだったか / Why array_value_first and array_value_last was declined, then why array_first and array_last was accpeted?
cocoeyes02
0
210
Featured
See All Featured
Making Projects Easy
brettharned
120
6.6k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
90
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
Building AI with AI
inesmontani
PRO
1
820
Odyssey Design
rkendrick25
PRO
2
560
30 Presentation Tips
portentint
PRO
1
260
Documentation Writing (for coders)
carmenintech
77
5.3k
BBQ
matthewcrist
89
10k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
410
AI: The stuff that nobody shows you
jnunemaker
PRO
3
490
Bash Introduction
62gerente
615
210k
Transcript
GitHub Actions とAWS をOIDC 認証で連携する
自己紹介 妹尾一弘 株式会社カオナビ (2025.03~) サーバーサイドエンジニア Go 書いてます 副業 英単語学習アプリ: モチタン
インフラ支援 JavaDo Java 勉強会コミュニティ 運営スタッフ
CI/CD の環境 CI のお仕事はCI 環境のみでは完結しない アプリケーション環境との連携が必須 コンテナイメージをPush したり Lambda をデプロイしたり
アプリケーション環境へのアクセスには認証が必要
CI/CD の認証の課題 人の認証はRole 利用が普及したが、CI 環境 ではまだ静的なシークレットの利用が多い IAM ユーザーのアクセスキーによる管理 漏洩リスクが心配 定期的な更新が必要
管理コストが高い
OIDC 認証とは OAuth 2.0 ベースの認証の仕組み トークンで一時的に認証する メリット: シークレットの管理が不要 一時的な認証情報のみを扱う
実装方法:AWS 側の設定① 1. IAM アイデンティティプロバイダーの作成 プロバイダのタイプ: OpenID Connect プロバイダのURL: https://token.actions.githubusercontent.com
対象者: sts.amazonaws.com
② IAM ロール作成 信頼ポリシーで接続許可 必要な権限を付与 { "Version": "2012-10-17", "Statement": [{
"Effect": "Allow", "Principal": { "Federated": "arn:aws:iam::123456789012:oidc-provider/token.actions.githubusercontent.com" }, "Action": "sts:AssumeRoleWithWebIdentity", "Condition": { "StringEquals": { "token.actions.githubusercontent.com:aud": "sts.amazonaws.com" }, "StringLike": { "token.actions.githubusercontent.com:sub": "repo:your-org/your-repo:*" } } }] }
セキュリティ強化のための条件設定 条件 設定例 効果 特定ブランチのみ repo:org/repo:ref:refs/heads/main main ブランチからのみ許可 特定タグのみ repo:org/repo:ref:refs/tags/v*
v で始まるタグからのみ許可 PR のみ repo:org/repo:pull_request PR からのみ許可 特定環境のみ repo:org/repo:environment:production production 環境からのみ許可 信頼ポリシーで接続元を制限できる "StringLike": { "token.actions.githubusercontent.com:sub": "repo:org/repo:ref:refs/heads/main" }
GitHub Actions 側の設定 id-token: write 権限追加 IAM ロールを指定するだけ アクセスキー不要 ワークフロー設定のポイント
name: Deploy to AWS on: push: branches: [ main ] jobs: deploy: runs-on: ubuntu-latest permissions: id-token: write # OIDC トークン取得に必要 contents: read steps: - uses: actions/checkout@v4 - name: AWS 認証設定 uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ vars.AWS_OIDC_ROLE_ARN }} aws-region: ap-northeast-1 - name: ECR アクセステスト run: aws ecr describe-repositories
まとめ 静的な認証情報が不要になる シンプルな設定で実装可能 柔軟なアクセス制御ができる OIDC 認証を使うことで
ありがとうございました