為 Lambda + DynamoDB 組合撰寫最小權限 IAM 政策
何時使用: 當你要將 Lambda 連接至 Dynamo 資料表,且不想授予萬用字元權限時。
步驟
-
描述所需的存取權限Use the aws iam + lambda skills. Write a policy for a Lambda that needs GetItem and UpdateItem on table Orders and nothing else.✓ 已複製→ 政策包含精確的動作與資源 ARN,不含萬用字元
-
測試驗證Give me the
aws iam simulate-custom-policycommand to verify this allows only those two actions.✓ 已複製→ 語法正確且可直接執行的指令
結果: 一份具備生產品質且附有驗證步驟的最小權限 IAM 政策。
注意事項
- 政策為了方便而使用萬用字元 — 要求使用精確的資源 ARN — 本技能對此有強力支援