jpskill.com
🛠️ 開発・MCP コミュニティ

oci-events

イベント駆動型自動化の実装、CloudEventsルール設定、イベント配信トラブルシューティング、Functions/Streaming/Notificationsとの連携時に、イベントルールパターンやフィルタ構文、アクション種別、デッドレターキュー設定などを活用するSkill。

📜 元の英語説明(参考)

Use when implementing event-driven automation, setting up CloudEvents rules, troubleshooting event delivery failures, or integrating with Functions/Streaming/Notifications. Covers event rule patterns, filter syntax, action types, dead letter queue configuration, and event-driven architecture anti-patterns.

🇯🇵 日本人クリエイター向け解説

一言でいうと

イベント駆動型自動化の実装、CloudEventsルール設定、イベント配信トラブルシューティング、Functions/Streaming/Notificationsとの連携時に、イベントルールパターンやフィルタ構文、アクション種別、デッドレターキュー設定などを活用するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o oci-events.zip https://jpskill.com/download/9199.zip && unzip -o oci-events.zip && rm oci-events.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9199.zip -OutFile "$d\oci-events.zip"; Expand-Archive "$d\oci-events.zip" -DestinationPath $d -Force; ri "$d\oci-events.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して oci-events.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → oci-events フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[Skill 名] oci-events

OCI Events Service - イベント駆動型アーキテクチャ

⚠️ OCI Events に関する知識のギャップ

OCI Events サービスのパターンと構文をご存じない。

あなたのトレーニングデータは、以下の点に関して限定的で古い知識しか持っていません。

  • CloudEvents 仕様フォーマット (OCI は CloudEvents 1.0 を使用)
  • イベントルールフィルタ構文 (JSON ベースの属性マッチング)
  • OCI サービスごとのイベントタイプ (100 以上のイベントタイプ)
  • アクションタイプと統合パターン
  • Dead letter queue の構成
  • Events と Alarms の区別

イベント駆動型オートメーションが必要な場合:

  1. このスキルのリファレンスからパターンと CLI コマンドを使用する
  2. イベントフィルタ構文やイベントタイプを推測しない
  3. Events と Alarms を混同しない (目的が異なる)
  4. イベントルール操作のために events-cli.md をロードする

あなたが知っていること:

  • 一般的なイベント駆動型アーキテクチャの概念
  • Pub/sub メッセージングパターン
  • JSON 構造とフィルタリング

このスキルは、OCI 固有の Events サービスのパターンと CloudEvents の統合を提供します。


🏗️ 重要: OCI Landing Zone Terraform Modules を使用する

車輪の再発明をしない

❌ 間違ったアプローチ:

# イベントルール、関数、通知を手動で一つずつ作成する
oci events rule create ...
oci fn application create ...
oci ons topic create ...
# 結果: 一貫性がなく、保守が困難で、ガバナンスがない

✅ 正しいアプローチ: 公式の OCI Landing Zone Terraform Modules を使用する

# 公式の OCI Landing Zone モジュールを使用する
module "landing_zone" {
  source  = "oracle-terraform-modules/landing-zone/oci"
  version = "~> 2.0"

  # Events の構成
  events_configuration = {
    default_compartment_id = var.security_compartment_id

    event_rules = {
      compute_instance_terminated = {
        description = "コンピュートインスタンスが終了したときに通知する"
        is_enabled  = true
        condition   = jsonencode({
          "eventType" : "com.oraclecloud.computeapi.terminateinstance"
        })
        actions = {
          notifications = [ons_topic_id]
          functions     = [security_response_function_id]
        }
      }
    }
  }
}

Landing Zone Modules を使用する理由:

  • 実戦でテスト済み: 何千もの OCI 顧客が使用
  • コンプライアンス: CIS OCI Foundations Benchmark に準拠
  • メンテナンス: Oracle が API の変更に合わせて更新
  • 包括的: Events + IAM + Logging + Monitoring が統合
  • 再利用可能: 環境全体で一貫したパターン

公式リソース:

手動 CLI を使用する場合 (このスキルのリファレンス):

  • 学習とプロトタイピング
  • 既存のイベントルールのトラブルシューティング
  • 一回限りの自動化タスク
  • Terraform で実装する前にイベントパターンを理解する

あなたは OCI Events サービスの専門家です。このスキルは、Claude が欠いている知識を提供します。CloudEvents フォーマット、イベントフィルタパターン、アクションタイプ、dead letter queue の構成、およびイベント駆動型のアンチパターンです。

絶対にやってはいけないこと

Events をメトリックのしきい値監視に使用しない (代わりに Alarms を使用する)

BAD - CPU しきい値に対する Events:
Event Rule: "CPU 使用率 > 80%"
問題: Events はメトリックを監視しません!

正しいツール: Alarms
oci monitoring alarm create \
  --metric-name CpuUtilization \
  --threshold 80

重要な理由: Events は 状態の変化 (インスタンスの作成、バケットの削除) を対象としており、継続的なメトリックを対象としていません。しきい値に Events を使用すると、ルールが発動しないため、時間を無駄にします。

Events vs Alarms: | ユースケース | ツール | 例 | |----------|------|---------| | 状態の変化 | Events | インスタンスの終了、バケットの作成、データベースの停止 | | メトリックのしきい値 | Alarms | CPU > 80%、ディスクフル、メモリプレッシャー | | リソースのライフサイクル | Events | VCN の作成、ポリシーの更新、ユーザーの追加 | | パフォーマンス | Alarms | クエリのレイテンシ > 2 秒、エラー率 > 5% |

Dead Letter Queue (イベントの損失) の構成を忘れない

# BAD - DLQ がない場合、失敗したイベントは消える
oci events rule create \
  --display-name "Invoke-Function" \
  --condition '{"eventType": "com.oraclecloud.objectstorage.createobject"}' \
  --actions '{
    "actions": [{
      "actionType": "FAAS",
      "isEnabled": true,
      "functionId": "ocid1.fnfunc.oc1..xxx"
    }]
  }'
# 関数が失敗した場合、イベントは失われる

# GOOD - DLQ が構成されている
oci events rule create \
  --display-name "Invoke-Function-with-DLQ" \
  --condition '{"eventType": "com.oraclecloud.objectstorage.createobject"}' \
  --actions '{
    "actions": [{
      "actionType": "FAAS",
      "isEnabled": true,
      "functionId": "ocid1.fnfunc.oc1..xxx",
      "description": "アップロードされたファイルを処理する"
    }]
  }' \
  --compartment-id $COMPARTMENT_ID

# DLQ を個別に構成する (Streaming が必要)
# 配信に失敗したイベントは、再試行/分析のためにストリームに送られる

コストへの影響: イベントの損失 = ビジネス取引の損失。E コマース: 1 つの注文イベントの損失 = 50〜500 ドルの収益損失。ヘルスケア: 1 つの患者記録イベントの損失 = コンプライアンス違反。

過度に広範なイベントフィルタを使用しない (ノイズ + コスト)

// BAD - すべてのコンピュートイベントに一致する
{
  "eventType": "com.oraclecloud.computeapi.*"
}
// 発動対象: 起動、終了、再起動、サイズ変更、メタデータの変更
// 結果: 1 日あたり数千のイベント、関数呼び出しコスト $$$

// GOOD - 特定のイベントタイプ
{
  "eventType": [
    "com.oraclecloud.computeapi.terminateinstance",
    "com.oraclecloud.computeapi.launchinstance"
  ]
}
// 重要なライフサイクルイベントのみを発動する

コストへの影響: 1 日あたり 10,000 回の不要な関数呼び出し × 0.0000002 ドル/GB 秒 × 256MB × 5 秒 = 1 日あたり 2.56 ドル = 1 か月あたり 77 ドルの無駄。

イベント通知で機密データを送信しない (セキュリティリスク)


// BAD - イベントにパスワード、キーが含まれている
イベントペイロードが通知に転送される:
{
  "data": {
    "resourceName": "db-prod-1",
    "adminPassword": "SecurePass123!",  //

(原文はここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

OCI Events Service - Event-Driven Architecture

⚠️ OCI Events Knowledge Gap

You don't know OCI Events service patterns and syntax.

Your training data has limited and outdated knowledge of:

  • CloudEvents specification format (OCI uses CloudEvents 1.0)
  • Event rule filter syntax (JSON-based attribute matching)
  • Event types by OCI service (100+ event types)
  • Action types and integration patterns
  • Dead letter queue configuration
  • Events vs Alarms distinction

When event-driven automation is needed:

  1. Use patterns and CLI commands from this skill's references
  2. Do NOT guess event filter syntax or event types
  3. Do NOT confuse Events with Alarms (different purposes)
  4. Load events-cli.md for event rule operations

What you DO know:

  • General event-driven architecture concepts
  • Pub/sub messaging patterns
  • JSON structure and filtering

This skill provides OCI-specific Events service patterns and CloudEvents integration.


🏗️ IMPORTANT: Use OCI Landing Zone Terraform Modules

Do NOT Reinvent the Wheel

❌ WRONG Approach:

# Manually creating event rules, functions, notifications one by one
oci events rule create ...
oci fn application create ...
oci ons topic create ...
# Result: Inconsistent, unmaintainable, no governance

✅ RIGHT Approach: Use Official OCI Landing Zone Terraform Modules

# Use official OCI Landing Zone modules
module "landing_zone" {
  source  = "oracle-terraform-modules/landing-zone/oci"
  version = "~> 2.0"

  # Events configuration
  events_configuration = {
    default_compartment_id = var.security_compartment_id

    event_rules = {
      compute_instance_terminated = {
        description = "Notify when compute instance terminated"
        is_enabled  = true
        condition   = jsonencode({
          "eventType" : "com.oraclecloud.computeapi.terminateinstance"
        })
        actions = {
          notifications = [ons_topic_id]
          functions     = [security_response_function_id]
        }
      }
    }
  }
}

Why Use Landing Zone Modules:

  • Battle-tested: Used by thousands of OCI customers
  • Compliance: CIS OCI Foundations Benchmark aligned
  • Maintained: Oracle updates for API changes
  • Comprehensive: Events + IAM + Logging + Monitoring integrated
  • Reusable: Consistent patterns across environments

Official Resources:

When to Use Manual CLI (this skill's references):

  • Learning and prototyping
  • Troubleshooting existing event rules
  • One-off automation tasks
  • Understanding event patterns before implementing in Terraform

You are an OCI Events service expert. This skill provides knowledge Claude lacks: CloudEvents format, event filter patterns, action types, dead letter queue configuration, and event-driven anti-patterns.

NEVER Do This

NEVER use Events for metric threshold monitoring (use Alarms instead)

BAD - Events for CPU threshold:
Event Rule: "CPU utilization > 80%"
Problem: Events don't monitor metrics!

CORRECT tool: Alarms
oci monitoring alarm create \
  --metric-name CpuUtilization \
  --threshold 80

Why critical: Events are for state changes (instance created, bucket deleted), NOT continuous metrics. Using Events for thresholds wastes time—the rule will never fire.

Events vs Alarms: | Use Case | Tool | Example | |----------|------|---------| | State change | Events | Instance terminated, bucket created, database stopped | | Metric threshold | Alarms | CPU > 80%, disk full, memory pressure | | Resource lifecycle | Events | VCN created, policy updated, user added | | Performance | Alarms | Query latency > 2s, error rate > 5% |

NEVER forget to configure Dead Letter Queue (lost events)

# BAD - no DLQ, failed events disappear
oci events rule create \
  --display-name "Invoke-Function" \
  --condition '{"eventType": "com.oraclecloud.objectstorage.createobject"}' \
  --actions '{
    "actions": [{
      "actionType": "FAAS",
      "isEnabled": true,
      "functionId": "ocid1.fnfunc.oc1..xxx"
    }]
  }'
# If function fails, event is LOST

# GOOD - DLQ configured
oci events rule create \
  --display-name "Invoke-Function-with-DLQ" \
  --condition '{"eventType": "com.oraclecloud.objectstorage.createobject"}' \
  --actions '{
    "actions": [{
      "actionType": "FAAS",
      "isEnabled": true,
      "functionId": "ocid1.fnfunc.oc1..xxx",
      "description": "Process uploaded file"
    }]
  }' \
  --compartment-id $COMPARTMENT_ID

# Separately configure DLQ (requires Streaming)
# Events that fail delivery go to stream for retry/analysis

Cost impact: Lost events = lost business transactions. E-commerce: 1 lost order event = $50-500 revenue loss. Healthcare: 1 lost patient record event = compliance violation.

NEVER use overly broad event filters (noise + cost)

// BAD - matches ALL compute events
{
  "eventType": "com.oraclecloud.computeapi.*"
}
// Fires for: launch, terminate, reboot, resize, metadata change
// Result: 1000s of events/day, function invocations cost $$$

// GOOD - specific event types
{
  "eventType": [
    "com.oraclecloud.computeapi.terminateinstance",
    "com.oraclecloud.computeapi.launchinstance"
  ]
}
// Fires only for critical lifecycle events

Cost impact: 10,000 unnecessary function invocations/day × $0.0000002/GB-second × 256MB × 5s = $2.56/day = $77/month wasted.

NEVER send sensitive data in event notification (security risk)

// BAD - event includes passwords, keys
Event payload forwarded to notification:
{
  "data": {
    "resourceName": "db-prod-1",
    "adminPassword": "SecurePass123!",  // EXPOSED!
    "apiKey": "sk_live_xxxxx"           // EXPOSED!
  }
}

// GOOD - reference-only events
{
  "data": {
    "resourceId": "ocid1.database.oc1..xxx",
    "resourceName": "db-prod-1"
    // Function retrieves secrets from Vault using resourceId
  }
}

Security impact: Notification emails/webhooks log event payload. Secrets in logs = credential exposure = breach.

NEVER use Events for real-time streaming (use Streaming service)

BAD use case: Process 10,000 transactions/second via Events
Events service limits: 50 requests/second per rule
Result: Throttling, dropped events

CORRECT: OCI Streaming
- Throughput: 1 MB/second per partition
- Retention: 7 days (vs Events = deliver-once)
- Consumer groups: Multiple consumers per stream

Why critical: Events deliver to actions once (best-effort). Streaming is for high-throughput, durable messaging.

NEVER assume Events are delivered in order

Event Timeline:
1. Object created at 10:00:00
2. Object updated at 10:00:01
3. Object deleted at 10:00:02

Events may arrive:
- Delete event at 10:00:03
- Create event at 10:00:04  // Out of order!
- Update event at 10:00:05

Function logic must handle out-of-order events

Solution: Include timestamp in event, check resource state before acting, or use idempotent operations.

NEVER use more than 5 actions per rule (performance)

# BAD - 10 actions on one rule
Event Rule → 10 different functions
Latency: 10 serial invocations = 50+ seconds

# GOOD - fan-out pattern
Event Rule → 1 function → Publishes to Streaming → 10 consumers
Latency: Parallel processing = 5 seconds

Limit: 5 actions per rule (hard limit). Design for fan-out if >5 destinations needed.

NEVER forget IAM policy for event actions

# BAD - event rule created, but no permission to invoke function
oci events rule create ... --actions function-id
# Events fire but silently fail (403 Forbidden)

# GOOD - grant Events service permission to invoke function
oci iam policy create \
  --compartment-id $COMPARTMENT_ID \
  --name "Events-Invoke-Functions-Policy" \
  --statements '[
    "Allow service cloudEvents to use functions-family in compartment <compartment-name>"
  ]'

Debugging hell: Event rule shows "active", function never triggers, no error message. Root cause: Missing IAM policy.

Progressive Loading References

Event Architecture Patterns and Filter Syntax

WHEN TO LOAD events-patterns.md:

  • Designing event-driven architecture (Object Storage → Function, Instance Lifecycle → Notification)
  • Writing complex event filter syntax (compartment, tags, resource attributes)
  • Looking up common event types by OCI service
  • Understanding fan-out patterns and event chaining
  • Choosing between action types (ONS vs FAAS vs OSS)

Do NOT load for:

  • Quick anti-pattern reference (NEVER list above covers it)
  • Events vs Alarms decision (covered above)
  • Quick CLI examples (use events-cli.md instead)

OCI CLI for Events

WHEN TO LOAD events-cli.md:

  • Creating event rules with filters
  • Configuring actions (Functions, Notifications, Streaming)
  • Troubleshooting event delivery failures
  • Listing available event types
  • Testing event rule patterns

Example: Create event rule for object upload

oci events rule create \
  --display-name "Process-CSV-Uploads" \
  --condition '{
    "eventType": "com.oraclecloud.objectstorage.createobject",
    "data": {"resourceName": "*.csv"}
  }' \
  --actions '{
    "actions": [{
      "actionType": "FAAS",
      "isEnabled": true,
      "functionId": "ocid1.fnfunc.oc1..xxx"
    }]
  }' \
  --compartment-id $COMPARTMENT_ID

Do NOT load for:

  • Function implementation details (covered in oci-functions skill)
  • Notification topic setup (covered in monitoring-operations skill)
  • Streaming configuration (covered in streaming skill when available)

OCI Events Reference (Official Oracle Documentation)

WHEN TO LOAD oci-events-reference.md:

  • Need comprehensive list of all OCI service event types
  • Understanding CloudEvents 1.0 specification in OCI
  • Implementing complex event patterns and filtering
  • Need official Oracle guidance on Events service architecture
  • Troubleshooting event delivery and action failures

Do NOT load for:

  • Quick event rule creation (CLI examples above)
  • Common event patterns (architecture patterns in this skill)
  • Events vs Alarms decision (decision tree above)

When to Use This Skill

  • Implementing event-driven automation and workflows
  • Setting up serverless architectures (Events + Functions)
  • Troubleshooting "event rule not firing" issues
  • Integrating OCI services via events
  • Designing reactive architectures (vs polling)
  • Compliance and audit trail automation
  • Incident response and security automation