

• AWS Systems Manager CloudWatch 대시보드는 2026년 4월 30일 이후에는 더 이상 사용할 수 없습니다. 고객은 Amazon CloudWatch 콘솔을 계속 사용하여 현재와 마찬가지로 Amazon CloudWatch 대시보드를 보고, 생성하고, 관리할 수 있습니다. 자세한 내용은 [Amazon CloudWatch 대시보드 설명서](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html)를 참조하세요.

# 자동 승인 및 액세스 거부 정책에 대한 문 구조 및 기본 제공 연산자
<a name="auto-approval-deny-access-policy-statement-structure"></a>

다음 표에는 자동 승인 및 액세스 거부 정책의 구조가 나와 있습니다.


| 구성 요소 | 구문 | 
| --- | --- | 
| effect | `permit \| forbid` | 
| 범위 | `(principal, action, resource)` | 
| 조건 절 |  <pre>when {<br />    {{principal or resource}} has {{attribute name}}             <br />};</pre>  | 

## 정책 구성 요소
<a name="policy-components"></a>

자동 승인 또는 액세스 거부 정책에는 다음 구성 요소가 포함됩니다.
+ **효과** - 액세스를 `permit`(허용) 또는 `forbid`(거부)합니다.
+ **범위** – 효과가 적용되는 위탁자, 작업 및 리소스입니다. 특정 위탁자, 작업 또는 리소스를 식별하지 않음으로써 Cedar의 범위를 정의하지 않은 상태로 둘 수 있습니다. 이 경우 가능한 모든 주체, 작업 및 리소스에 정책이 적용됩니다. JIT(Just-in-Time) 노드 액세스에서 `action`은 항상 `AWS::SSM::Action::"getTokenForInstanceAccess"`입니다.
+ **조건 절** - 효과가 적용되는 컨텍스트입니다.

## 설명
<a name="auth-policies-policy-comments"></a>

 정책에 주석을 포함할 수 있습니다. 주석은 `//`로 시작하고 줄바꿈 문자로 끝나는 줄로 정의됩니다.

다음 예는 정책의 주석을 보여줍니다.

```
// Allows users in the Engineering group from the Platform org to automatically connect to nodes tagged with Engineering and Production keys. 
permit (
    principal in AWS::IdentityStore::Group::"d4q81745-r081-7079-d789-14da1EXAMPLE",
    action == AWS::SSM::Action::"getTokenForInstanceAccess",
    resource
)
when {
    principal has organization && resource.hasTag("Engineering") && resource.hasTag("Production") && principal.organization == "Platform"
};
```

## 여러 절
<a name="multiple-clauses"></a>

`&&` 연산자를 사용하여 정책 문에 조건 절을 두 개 이상 사용할 수 있습니다.

```
// Allow access if node has tag where the tag key is Environment 
// & tag value is Development 

permit(principal, action == AWS::SSM::getTokenForInstanceAccess, resource)
when {
    resource.hasTag("Environment") &&
    resource.getTag("Environment") == "Development"
};
```

## 예약 문자
<a name="reserved-characters"></a>

다음 예제는 컨텍스트 속성이 정책 언어의 예약 문자인 `:`(세미콜론)을 사용하는 경우 정책을 작성하는 방법을 보여줍니다.

```
permit (
    principal,
    action == AWS::SSM::Action::"getTokenForInstanceAccess",
    resource
)
when {
    principal has employeeNumber && principal.employeeNumber like "E-1*" && resource.hasTag("Purpose") && resource.getTag("Purpose") == "Testing"
}
```

추가 예제는 다음([정책 문 예제](#policy-statement-examples))을 참조하십시오.

## JIT(Just-in-Time) 노드 액세스 스키마
<a name="auto-approval-deny-access-policy-statement-schema"></a>

다음은 JIT(Just-in-Time) 노드 액세스에 대한 Cedar 스키마입니다.

```
namespace AWS::EC2 {
    entity Instance tags String;
}


namespace AWS::IdentityStore {
    entity Group;
    
    entity User in [Group] {
    employeeNumber?: String,
    costCenter?: String,
    organization?: String,
    division?: String,
    };

}


namespace AWS::IAM {

    entity Role;
    
    type AuthorizationContext = {
        principalTags: PrincipalTags,
    };
    
    entity PrincipalTags tags String;
}

namespace AWS::SSM {

    entity ManagedInstance tags String;

    action "getTokenForInstanceAccess" appliesTo {
    principal: [AWS::IdentityStore::User],
    resource: [AWS::EC2::Instance, AWS::SSM::ManagedInstance],
    context: {
        "iam": AWS::IAM::AuthorizationContext
        }
    };
}
```

## 내장 연산자
<a name="built-in-policy-operators"></a>

다양한 조건을 사용하여 자동 승인 또는 액세스 거부 정책의 컨텍스트를 생성할 때는 `&&` 연산자를 사용하여 추가 조건을 추가할 수 있습니다. 정책 조건에 추가적인 표현력을 추가하는 데 사용할 수 있는 다른 내장 연산자도 많이 있습니다. 다음 표에는 참조용으로 제공되는 모든 내장 연산자가 나와 있습니다.



- ** \! **
  - **유형 및 오버로드:** Boolean → Boolean
  - **설명:** 논리 not.

- ** == **
  - **유형 및 오버로드:** any → any
  - **설명:** 대등. 유형이 일치하지 않는 경우에도 모든 유형의 값에서 작동합니다. 서로 다른 유형의 값은 결코 서로 같을 수 없습니다.

- **\!=**
  - **유형 및 오버로드:** any → any
  - **설명:** 부등, 대등의 정반대(위 참조).

- ** < **
  - **유형 및 오버로드:** (long, long) → Boolean
  - **설명:** 보다 작은 배장 정수.

- ** <= **
  - **유형 및 오버로드:** (long, long) → Boolean
  - **설명:** 작거나 같은 배장 정수.

- ** > **
  - **유형 및 오버로드:** (long, long) → Boolean
  - **설명:** 보다 큰 배장 정수.

- ** >= **
  - **유형 및 오버로드:** (long, long) → Boolean
  - **설명:** 크거나 같은 배장 정수.

- **in**
  - **유형 및 오버로드:** (entity, entity) → Boolean / **설명:** 계층 멤버십(재귀적: A의 A는 항상 참임).
  - **유형 및 오버로드:** (entity, set(entity)) → Boolean / **설명:** 계층 멤버십: (A와 B) \|\| (C의 A) \|\|이면 [B, C,...] 의 A는 참이며 ... 집합에 개체가 아닌 항목이 포함된 경우 오류입니다.

- **&&**
  - **유형 및 오버로드:** (Boolean, Boolean) → Boolean
  - **설명:** 논리 및 (단락 평가).

- **\|\|**
  - **유형 및 오버로드:** (Boolean, Boolean) → Boolean
  - **설명:** 논리 또는 (단락 평가).

- **.exists()**
  - **유형 및 오버로드:** entity → Boolean
  - **설명:** 엔터티 존재.

- **has**
  - **유형 및 오버로드:** (entity, attribute) → Boolean
  - **설명:** 중위 연산자. e has f은(는) 레코드 또는 엔터티 e에 속성 f에 대한 바인딩이 있는지 테스트합니다. e가 존재하지 않는 경우 또는 e가 존재하지만 속성 f가 없는 경우 false를 반환합니다. 속성은 식별자 또는 문자열로 표현할 수 있습니다.

- **like**
  - **유형 및 오버로드:** (string, string) → Boolean
  - **설명:** 중위 연산자. t like p은(는) 텍스트 t가 패턴 p과 일치하는지 확인합니다. 패턴에는 0개 이상의 문자와 일치하는 와일드카드 문자 \*가 포함될 수 있습니다. t에서 문자 그대로의 별표 문자를 일치시키려면 p의 \\\*에서 특수 문자열을 사용할 수 있습니다.

- **.hasTag()**
  - **유형 및 오버로드:** (엔터티, 문자열) → 부울
  - **설명:** 엔터티에 지정된 태그가 적용되었는지 확인합니다.

- **.getTag()**
  - **유형 및 오버로드:** (엔터티, 문자열) → 부울
  - **설명:** 지정된 태그 키의 값을 반환합니다.

- **.contains()**
  - **유형 및 오버로드:** (set, any) → Boolean
  - **설명:** 멤버십을 설정합니다(B는 A의 요소인지).

- **.containsAll()**
  - **유형 및 오버로드:** (set, set) → Boolean
  - **설명:** A 집합에 B 집합의 모든 요소가 포함되어 있는지 테스트합니다.

- **.containsAny()**
  - **유형 및 오버로드:** (set, set) → Boolean
  - **설명:** A 집합에 B 집합의 요소가 포함되어 있는지 테스트합니다.



## 정책 문 예제
<a name="policy-statement-examples"></a>

다음은 정책 문의 예제입니다.

```
// Users assuming IAM roles with a principal tag of "Elevated" can automatically access nodes tagged with the "Environment" key when the value equals "prod"
permit(principal, action == AWS::SSM::getTokenForInstanceAccess, resource)
when {
    // Verify IAM role principal tag
    context.iam.principalTags.getTag("AccessLevel") == "Elevated" &&
    
    // Verify the node has a tag with "Environment" tag key and a tag value of "prod"
    resource.hasTag("Environment") &&
    resource.getTag("Environment") == "prod"
};
```

```
// Identity Center users in the "Contractor" division can automatically access nodes tagged with the "Environment" key when the value equals "dev"
permit(principal, action == AWS::SSM::getTokenForInstanceAccess, resource)
when {
    // Verify that the user is part of the "Contractor" division
    principal.division == "Contractor" &&
    
    // Verify the node has a tag with "Environment" tag key and a tag value of "dev"
    resource.hasTag("Environment") &&
    resource.getTag("Environment") == "dev"
};
```

```
// Identity Center users in a specified group can automatically access nodes tagged with the "Environment" key when the value equals "Production"
permit(principal in AWS::IdentityStore::Group::"d4q81745-r081-7079-d789-14da1EXAMPLE",
    action == AWS::SSM::getTokenForInstanceAccess,
    resource)
when {
    resource.hasTag("Environment") &&
    resource.getTag("Environment") == "Production"
};
```