조건 키 사용 - 아마존 ElastiCache (레디 스OSS)

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

조건 키 사용

IAM 정책이 적용되는 방식을 결정하는 조건을 지정할 수 있습니다. ElastiCache에서는 JSON 정책의 Condition 요소를 사용하여 요청 컨텍스트의 키를 정책에서 지정한 키 값과 비교할 수 있습니다. 자세한 정보는 IAM JSON 정책 요소: 조건을 참조하세요.

ElastiCache 조건 키 목록을 보려면 서비스 권한 부여 ElastiCache 참조의 Amazon용 조건 키를 참조하십시오.

글로벌 조건 키의 목록은 AWS 글로벌 조건 컨텍스트 키를 참조하세요.

조건 지정: 조건 키 사용

세분화된 제어를 구현하려면 특정 요청에 대한 개별 파라미터 집합을 제어하는 조건을 지정하는 IAM 권한 정책을 작성합니다. 그런 다음 IAM 콘솔을 사용하여 만드는 IAM 사용자, 그룹 또는 역할에 정책을 적용합니다.

조건을 적용하려면 IAM 정책 설명에 조건 정보를 추가합니다. 다음 예제에서는 생성된 모든 자체 설계 캐시 클러스터가 cache.r5.large 노드 유형이 되도록 조건을 지정합니다.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:cluster:*", "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "StringEquals": { "elasticache:CacheNodeType": [ "cache.r5.large" ] } } } ] }

자세한 내용은 태그 기반 액세스 제어 정책 예제 섹션을 참조하세요.

정책 조건 연산자 사용에 대한 자세한 내용은 ElastiCache API 권한: 작업, 리소스, 조건 참조 섹션을 참조하세요.

정책 예: 조건을 사용하여 세부적인 파라미터 제어 구현

이 섹션에서는 앞서 나열한 파라미터에 대해 세분화된 액세스 제어를 구현하기 위한 예제 정책을 보여줍니다. ElastiCache

  1. Elasticache:MaximumDataStorage: 서버리스 캐시의 최대 데이터 스토리지를 지정합니다. 고객은 제공된 조건을 사용할 때 특정 양의 데이터보다 많이 저장할 수 있는 캐시는 생성할 수 없습니다.

    { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowDependentResources", "Effect": "Allow", "Action": [ "elasticache:CreateServerlessCache" ], "Resource": [ "arn:aws:elasticache:*:*:serverlesscachesnapshot:*", "arn:aws:elasticache:*:*:snapshot:*", "arn:aws:elasticache:*:*:usergroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateServerlessCache" ], "Resource": [ "arn:aws:elasticache:*:*:serverlesscache:*" ], "Condition": { "NumericLessThanEquals": { "elasticache:MaximumDataStorage": "30" }, "StringEquals": { "elasticache:DataStorageUnit": "GB" } } } ] }
  2. 엘라스티캐시: 최대 CPU: 서버리스 캐시의 초당 최대 ECPU 값을 지정합니다PerSecond. 고객은 제공된 조건을 사용할 때 초당 특정 수의 ECPU보다 많이 실행할 수 있는 캐시는 생성할 수 없습니다.

    { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowDependentResources", "Effect": "Allow", "Action": [ "elasticache:CreateServerlessCache" ], "Resource": [ "arn:aws:elasticache:*:*:serverlesscachesnapshot:*", "arn:aws:elasticache:*:*:snapshot:*", "arn:aws:elasticache:*:*:usergroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateServerlessCache" ], "Resource": [ "arn:aws:elasticache:*:*:serverlesscache:*" ], "Condition": { "NumericLessThanEquals": { "elasticache:MaximumECPUPerSecond": "100000" } } } ] }
  3. 엘라스티캐시:: 사용자가 생성할 수 있는 항목을 지정합니다. CacheNodeType NodeType 제공된 조건을 사용하여 고객은 노드 유형에 대해 단일 또는 범위 값을 지정할 수 있습니다.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:cluster:*", "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "StringEquals": { "elasticache:CacheNodeType": [ "cache.t2.micro", "cache.t2.medium" ] } } } ] }
  4. 엘라스티캐시NumNodeGroups: 20개 미만의 노드 그룹으로 복제 그룹을 생성합니다.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "NumericLessThanEquals": { "elasticache:NumNodeGroups": "20" } } } ] }
  5. 엘라스티캐시:ReplicasPerNodeGroup: 노드당 복제본을 5~10개 사이로 지정합니다.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "NumericGreaterThanEquals": { "elasticache:ReplicasPerNodeGroup": "5" }, "NumericLessThanEquals": { "elasticache:ReplicasPerNodeGroup": "10" } } } ] }
  6. 엘라스티캐시:EngineVersion: 엔진 버전 5.0.6의 사용량을 지정하세요.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:cluster:*", "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "StringEquals": { "elasticache:EngineVersion": "5.0.6" } } } ] }
  7. 엘라스티캐시EngineType: Redis OSS 엔진만 사용하여 지정하십시오.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:cluster:*", "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "StringEquals": { "elasticache:EngineType": "redis" } } } ] }
  8. Elasticache:AtRestEncryptionEnabled: 암호화가 활성화된 상태에서만 복제 그룹을 생성하도록 지정합니다.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "Bool": { "elasticache:AtRestEncryptionEnabled": "true" } } } ] }
  9. 엘라스티캐시: TransitEncryptionEnabled

    1. CreateReplicationGroup작업의 elasticache:TransitEncryptionEnabled 조건 키를 로 false 설정하여 TLS를 사용하지 않는 경우에만 복제 그룹을 생성할 수 있도록 지정합니다.

      { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "Bool": { "elasticache:TransitEncryptionEnabled": "false" } } } ] }

      CreateReplicationGroup작업에 대한 false 정책에서 elasticache:TransitEncryptionEnabled 조건 키를 로 설정하면 TLS를 사용하지 않는 경우 (즉, CreateReplicationGroup 요청에 로 설정된 파라미터 true 또는 로 설정된 TransitEncryptionEnabled 파라미터가 포함되지 않은 경우) 에만 요청이 허용됩니다. TransitEncryptionMode required

    2. CreateReplicationGroup작업의 elasticache:TransitEncryptionEnabled 조건 키를 로 설정하여 true TLS를 사용할 때만 복제 그룹을 생성할 수 있도록 지정합니다.

      { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "Bool": { "elasticache:TransitEncryptionEnabled": "true" } } } ] }

      CreateReplicationGroup작업에 대한 true 정책에서 elasticache:TransitEncryptionEnabled 조건 키를 로 설정하면 CreateReplicationGroup 요청에 로 설정된 true 파라미터와 로 설정된 TransitEncryptionEnabled 파라미터가 포함된 경우에만 요청이 허용됩니다. TransitEncryptionMode required

    3. TLS를 사용할 때만 복제 그룹을 수정할 수 있도록 지정하는 ModifyReplicationGroup 작업을 수행하려면 elasticache:TransitEncryptionEnabledtrue로 설정합니다.

      { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:ModifyReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "BoolIfExists": { "elasticache:TransitEncryptionEnabled": "true" } } } ] }

      ModifyReplicationGroup작업에 대한 true 정책에서 elasticache:TransitEncryptionEnabled 조건 키를 로 설정하면 ModifyReplicationGroup 요청에 로 설정된 TransitEncryptionMode 매개변수가 포함된 경우에만 요청이 허용됩니다required. true로 설정된 TransitEncryptionEnabled 파라미터도 선택적으로 포함될 수 있지만 이 경우 TLS를 활성화하는 데 필요하지 않습니다.

  10. Elasticache: AutomaticFailoverEnabled: 자동 장애 조치가 활성화된 상태에서만 복제 그룹을 생성하도록 지정합니다.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "Bool": { "elasticache:AutomaticFailoverEnabled": "true" } } } ] }
  11. elasticache:MultiAZEnabled:   다중 AZ가 비활성화된 상태에서는 복제 그룹을 생성할 수 없도록 지정합니다.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Deny", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:cluster:*", "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "Bool": { "elasticache:MultiAZEnabled": "false" } } } ] }
  12. Elasticache:ClusterModeEnabled: 클러스터 모드가 활성화된 상태에서만 복제 그룹을 생성할 수 있도록 지정합니다.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "Bool": { "elasticache:ClusterModeEnabled": "true" } } } ] }
  13. ElasticacheAuthTokenEnabled: AUTH 토큰이 활성화된 상태에서만 복제 그룹을 생성할 수 있도록 지정합니다.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:cluster:*", "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "Bool": { "elasticache:AuthTokenEnabled": "true" } } } ] }
  14. Elasticache:SnapshotRetentionLimit: 스냅샷을 보관할 일수 (또는 최소/최대) 를 지정합니다. 아래 정책은 최소 30일 동안 백업을 저장하도록 지정합니다.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup", "elasticache:CreateServerlessCache" ], "Resource": [ "arn:aws:elasticache:*:*:cluster:*", "arn:aws:elasticache:*:*:replicationgroup:*", "arn:aws:elasticache:*:*:serverlesscache:*" ], "Condition": { "NumericGreaterThanEquals": { "elasticache:SnapshotRetentionLimit": "30" } } } ] }
  15. 엘라스티캐시KmsKeyId: 고객 관리형 KMS 키 사용량을 지정합니다. AWS

    { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowDependentResources", "Effect": "Allow", "Action": [ "elasticache:CreateServerlessCache" ], "Resource": [ "arn:aws:elasticache:*:*:serverlesscachesnapshot:*", "arn:aws:elasticache:*:*:snapshot:*", "arn:aws:elasticache:*:*:usergroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateServerlessCache" ], "Resource": [ "arn:aws:elasticache:*:*:serverlesscache:*" ], "Condition": { "StringEquals": { "elasticache:KmsKeyId": "my-key" } } } ] }
  16. ElasticacheCacheParameterGroupName: 클러스터에 있는 조직의 특정 파라미터를 사용하여 기본이 아닌 파라미터 그룹을 지정합니다. 파라미터 그룹에 대한 이름 지정 패턴을 지정하거나 특정 파라미터 그룹 이름에 대한 블록 삭제를 지정할 수도 있습니다. 다음은 "“로만 사용을 제한하는 예제입니다. my-org-param-group

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:cluster:*", "arn:aws:elasticache:*:*:replicationgroup:*" ], "Condition": { "StringEquals": { "elasticache:CacheParameterGroupName": "my-org-param-group" } } } ] }
  17. elasticache: CreateCacheCluster: 요청 태그가 Project 없거나 또는 와 같지 않은 경우 CreateCacheCluster 작업을 거부합니다. Dev QA Prod

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*", "arn:aws:elasticache:*:*:securitygroup:*", "arn:aws:elasticache:*:*:replicationgroup:*" ] }, { "Effect": "Deny", "Action": [ "elasticache:CreateCacheCluster" ], "Resource": [ "arn:aws:elasticache:*:*:cluster:*" ], "Condition": { "Null": { "aws:RequestTag/Project": "true" } } }, { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:AddTagsToResource" ], "Resource": "arn:aws:elasticache:*:*:cluster:*", "Condition": { "StringEquals": { "aws:RequestTag/Project": [ "Dev", "Prod", "QA" ] } } } ] }
  18. 엘라스티캐시CacheNodeType: 캐시.r5.large 또는 cacheNodeType cache.r6g.4xlarge CreateCacheCluster 및 태그를 사용하여 허용합니다. Project=XYZ

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster", "elasticache:CreateReplicationGroup" ], "Resource": [ "arn:aws:elasticache:*:*:parametergroup:*", "arn:aws:elasticache:*:*:subnetgroup:*" ] }, { "Effect": "Allow", "Action": [ "elasticache:CreateCacheCluster" ], "Resource": [ "arn:aws:elasticache:*:*:cluster:*" ], "Condition": { "StringEqualsIfExists": { "elasticache:CacheNodeType": [ "cache.r5.large", "cache.r6g.4xlarge" ] }, "StringEquals": { "aws:RequestTag/Project": "XYZ" } } } ] }
참고

태그와 다른 조건 키를 함께 적용하기 위한 정책을 생성할 때 --tags 파라미터가 있는 생성 요청청에 대한 별도의 elasticache:AddTagsToResource 정책 요구 사항으로 인해 조건 키 요소에서 조건부 IfExists가 필요할 수 있습니다.