

• 2026 年 4 月 30 日之後， AWS Systems Manager CloudWatch Dashboard 將不再可用。客戶可以繼續使用 Amazon CloudWatch 主控台來檢視、建立和管理其 Amazon CloudWatch 儀表板，就像現在一樣。如需詳細資訊，請參閱 [Amazon CloudWatch Dashboard 文件](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 防止存取 Parameter Store API 操作
<a name="parameter-store-policy-conditions"></a>

使用 Systems Manager for AWS Identity and Access Management (IAM) 政策支援的服務特定*[條件](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)*，您可以明確允許或拒絕存取 Parameter Store API 操作和內容。若使用這些條件，您只能允許組織中的特定 IAM 實體 (使用者和角色) 呼叫特定 API 動作，或防止特定 IAM 實體執行這些動作。這包括透過 Parameter Store 主控台、 AWS Command Line Interface (AWS CLI) 和 SDKs執行的動作。

Systems Manager 目前支援特定於 Parameter Store 的三個條件。

**Topics**
+ [使用 `ssm:Overwrite` 防止變更現有參數](#overwrite-condition)
+ [防止使用 `ssm:Policies` 建立或更新使用參數政策的參數](#parameter-policies-condition)
+ [使用 `ssm:Recursive` 防止存取階層參數中的層級](#recursive-condition)

## 使用 `ssm:Overwrite` 防止變更現有參數
<a name="overwrite-condition"></a>

使用 `ssm:Overwrite` 條件來控制 IAM 實體是否可以更新現有參數。

在下列範例政策中， `"Allow"`陳述式會授予在美國東部 （俄亥俄） 區域 (us-east-2) 的 AWS 帳戶 123456789012 中執行 `PutParameter` API 操作來建立參數的許可。

但是，`"Deny"` 陳述式會防止實體變更*現有*參數的值，因為 `PutParameter` 操作會明確拒絕 `Overwrite` 選項。因此，經指派此政策的實體可以建立參數，但無法變更現有參數。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ssm:PutParameter"
            ],
            "Resource": "arn:aws:ssm:us-east-1:111122223333:parameter/*"
        },
        {
            "Effect": "Deny",
            "Action": [
                "ssm:PutParameter"
            ],
            "Condition": {
                "StringEquals": {
                    "ssm:Overwrite": [
                        "true"
                    ]
                }
            },
            "Resource": "arn:aws:ssm:us-east-1:111122223333:parameter/*"
        }
    ]
}
```

------

## 防止使用 `ssm:Policies` 建立或更新使用參數政策的參數
<a name="parameter-policies-condition"></a>

使用 `ssm:Policies` 條件，控制實體是否可以建立包含參數政策的參數，並更新包含參數政策的現有參數。

在下列政策範例中， `"Allow"`陳述式會授予建立參數的一般許可，但 `"Deny"`陳述式會防止實體在美國東部 （俄亥俄） 區域 (us-east-2) 的 AWS 帳戶 123456789012 中建立或更新包含參數政策的參數。實體仍可以建立或更新未指派有參數政策的參數。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ssm:PutParameter"
            ],
            "Resource": "arn:aws:ssm:us-east-1:111122223333:parameter/*"
        },
        {
            "Effect": "Deny",
            "Action": [
                "ssm:PutParameter"
            ],
            "Condition": {
                "StringEquals": {
                    "ssm:Policies": [
                        "true"
                    ]
                }
            },
            "Resource": "arn:aws:ssm:us-east-1:111122223333:parameter/*"
        }
    ]
}
```

------

## 使用 `ssm:Recursive` 防止存取階層參數中的層級
<a name="recursive-condition"></a>

使用 `ssm:Recursive` 條件來控制 IAM 實體是否可以在階層參數中檢視或參考層級。您可以提供或限制對階層特定層級以外之所有參數的存取權。

在下列範例政策中，`"Allow"` 陳述式提供對美國東部 (俄亥俄) 區域 (us-east-2) 中 AWS 帳戶 123456789012 之 `/Code/Departments/Finance/*` 路徑裡所有參數之 Parameter Store 操作的存取權。

之後，`"Deny"` 陳述式會防止 IAM 實體檢視或擷取處於或低於 `/Code/Departments/*` 層級的參數資料。不過，實體仍可在該路徑中建立或更新參數。建構此範例以說明，在參數階層中以遞迴方式拒絕低於特定層級的存取，優先於相同政策中更寬鬆的存取。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ssm:*"
            ],
            "Resource": "arn:aws:ssm:us-east-1:111122223333:parameter/*"
        },
        {
            "Effect": "Deny",
            "Action": [
                "ssm:GetParametersByPath"
            ],
            "Condition": {
                "StringEquals": {
                    "ssm:Recursive": [
                        "true"
                    ]
                }
            },
            "Resource": "arn:aws:ssm:us-east-1:111122223333:parameter/Code/Departments/*"
        }
    ]
}
```

------

**重要**  
如果使用者擁有路徑的存取權限，則該使用者可存取該路徑的所有層級。例如，如果使用者擁有存取路徑 `/a` 的許可，則該使用者也可以存取 `/a/b`。除非使用者在 `/b` 參數的 IAM 中明確遭到拒絕存取，否則都是如此 (如上所示)。