Fähigkeiten assume-cloudformation-role
📦

assume-cloudformation-role

Niedriges Risiko ⚙️ Externe Befehle📁 Dateisystemzugriff🔑 Umgebungsvariablen

使用臨時憑證假設 AWS CloudFormation IAM 角色

管理 AWS CloudFormation 堆疊需要適當的 IAM 角色憑證,手動配置可能相當複雜。此技能透過 AWS STS 自動執行假設 IAM 角色的過程,取得臨時憑證,並將其設為環境變數,以實現無縫的 CloudFormation 操作。

Unterstützt: Claude Codex Code(CC)
⚠️ 68 Schlecht
1

Die Skill-ZIP herunterladen

2

In Claude hochladen

Gehe zu Einstellungen → Fähigkeiten → Skills → Skill hochladen

3

Einschalten und loslegen

Teste es

Verwendung von "assume-cloudformation-role". 使用預設配置假設 CloudFormation 寫入角色

Erwartetes Ergebnis:

成功假設角色 arn:aws:iam::692859919890:role/CloudFormationWriteRole
已設定環境變數:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_SESSION_TOKEN

您現在可以使用假設的角色憑證執行 CloudFormation 命令。

Verwendung von "assume-cloudformation-role". 使用 prod 配置檔案假設角色 arn:aws:iam::123456789012:role/DeployRole 並建立堆疊 my-app

Erwartetes Ergebnis:

已假設的角色:arn:aws:iam::123456789012:role/DeployRole
會話:cfn-write
已取得憑證並設定為環境變數

正在建立 CloudFormation 堆疊:my-app
堆疊建立已啟動
堆疊 ID:arn:aws:cloudformation:us-east-1:123456789012:stack/my-app/abc123

Sicherheitsaudit

Niedriges Risiko
v6 • 1/21/2026

This skill automates AWS IAM role assumption for CloudFormation operations. Static analysis detected 59 potential issues, but upon evaluation, all are false positives or legitimate AWS credential management patterns. The skill uses standard AWS CLI commands to obtain temporary credentials via STS AssumeRole, stores them briefly in /tmp, and sets environment variables. This is a standard DevOps workflow with no malicious intent. Risk level is low due to AWS credential handling, but all operations are legitimate and well-documented.

2
Gescannte Dateien
728
Analysierte Zeilen
5
befunde
6
Gesamtzahl Audits
Probleme mit niedrigem Risiko (2)
AWS Credential Environment Variables
The skill sets AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN environment variables. This is the documented purpose of the skill and follows AWS CLI standard practices for temporary credential management. The credentials are obtained via legitimate AWS STS AssumeRole API and are temporary in nature.
Temporary File Storage
Credentials are temporarily stored in /tmp/creds.json before being parsed and set as environment variables. The file is properly cleaned up after use. This is a common pattern for credential handling in shell scripts.

Risikofaktoren

⚙️ Externe Befehle (2)
📁 Dateisystemzugriff (3)
🔑 Umgebungsvariablen (2)
Auditiert von: claude Audit-Verlauf anzeigen →

Qualitätsbewertung

38
Architektur
100
Wartbarkeit
87
Inhalt
30
Community
86
Sicherheit
91
Spezifikationskonformität

Was du bauen kannst

DevOps 工程師 - CloudFormation 堆疊部署

在透過 CloudFormation 部署基礎架構更新之前自動執行 IAM 角色假設,確保堆疊建立和更新的適當權限,無需手動憑證配置。

雲端架構師 - 多帳戶 AWS 管理

在管理組織中多個 AWS 帳戶的 CloudFormation 堆疊時,快速切換不同的 AWS 帳戶角色,簡化跨帳戶基礎架構操作。

平台工程師 - 自動化基礎架構工作流程

將 IAM 角色假設整合到 Claude Code 工作流程中,以實現自動化基礎架構佈建,消除 CI/CD 管道中的手動憑證管理。

Probiere diese Prompts

基本 CloudFormation 角色假設
使用預設配置檔案和角色 ARN 假設 CloudFormation 寫入角色
自訂配置檔案和角色
使用 production 配置檔案透過會話名稱 my-deployment 假設 IAM 角色 arn:aws:iam::123456789012:role/CustomCFNRole
角色假設後部署 CloudFormation 堆疊
假設 CloudFormation 角色,然後使用 template.yaml 建立名為 my-infrastructure 的新堆疊
使用假設的角色更新多個堆疊
假設 staging 配置檔案的 CloudFormation 角色,然後使用各自的模板更新 frontend-stack 和 backend-stack

Bewährte Verfahren

  • 在嘗試假設角色之前,請務必驗證您的來源 AWS 配置檔案是否具有目標 IAM 角色的 sts:AssumeRole 權限
  • 使用描述性的角色會話名稱來識別假設角色會話的目的或使用者,以獲得更好的 AWS CloudTrail 審計
  • 當憑證過期時(通常在 1 小時後)重新假設角色,而非延長會話持續時間,以維護安全最佳實踐

Vermeiden

  • 不要將敏感的角色 ARN 或帳戶 ID 直接硬編碼在提示中;盡可能使用變數或配置檔案
  • 避免假設具有過於廣泛權限的角色;對 CloudFormation 操作使用特定的最少權限 IAM 角色
  • 不要對超過典型 1 小時會話持續時間的長期操作依賴假設的角色憑證,而未實作重新假設邏輯

Häufig gestellte Fragen

如果我的臨時憑證在 CloudFormation 操作期間過期會怎麼樣?
使用有效憑證啟動的 AWS CloudFormation 操作即使憑證在操作中途過期也會繼續。但是,您需要重新假設角色才能執行新操作。最佳實踐是在啟動 CloudFormation 操作之前立即假設角色。
我可以在 AWS 組織和跨帳戶角色中使用此技能嗎?
是的,此技能支援跨帳戶角色假設。確保您的來源 AWS 配置檔案與另一個帳戶中的目標角色具有信任關係,並指定包含帳戶 ID 的完整角色 ARN。
除了 AWS CLI 之外,我還需要安裝任何其他工具嗎?
是的,您需要在系統上安裝 jq(JSON 處理器)。此技能使用 jq ��解析 AWS STS AssumeRole 回應並擷取憑證。使用系統套件管理員安裝 jq。
憑證會永久儲存在我的系統上嗎?
不會,憑證暫時儲存在 /tmp/creds.json 中,並在解析並設為環境變數後立即刪除。它們只會在您關閉會話或憑證過期之前保留在目前的 Shell 會話中。
我可以自訂假設角色的會話持續時間嗎?
此技能使用 IAM 角色信任政策中設定的預設會話持續時間。若要自訂持續時間,您需要修改 aws sts assume-role 命令以包含 --duration-seconds 參數。
我的來源配置檔案需要什麼權限才能假設 CloudFormation 角色?
您的來源 AWS 配置檔案必須對特定角色 ARN 具有 sts:AssumeRole 權限。此外,目標 IAM 角色必須具有信任政策,允許您的來源帳戶或使用者假設它。

Entwicklerdetails

Dateistruktur

📄 SKILL.md