

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

# Amazon Security Lake와 Amazon Detective 통합
<a name="securitylake-integration"></a>

Amazon Security Lake는 완전 관리형 보안 데이터 레이크 서비스입니다. Security Lake를 사용하여 AWS 환경, SaaS 공급자, 온프레미스 소스, 클라우드 소스 및 타사 소스의 보안 데이터를 AWS 계정에 저장된 전용 데이터 레이크로 자동으로 중앙 집중화할 수 있습니다. Security Lake를 사용하면 보안 데이터를 분석할 수 있으므로 조직 전체의 보안 상태를 더 완벽하게 이해할 수 있습니다. Security Lake를 사용하면 워크로드, 애플리케이션 및 데이터에 대한 보호도 개선할 수 있습니다.

Amazon Detective는 Security Lake와 통합되어 Security Lake에 저장된 원시 로그 데이터를 쿼리하고 검색할 수 있습니다.

이 통합을 사용하면 Security Lake에서 기본적으로 지원하는 다음 소스에서 로그와 이벤트를 수집할 수 있습니다. Detective는 최대 소스 버전 2(OCSF 1.1.0)를 지원합니다.
+ AWS CloudTrail 관리 이벤트 버전 1.0 이상
+ Amazon Virtual Private Cloud(Amazon VPC) 흐름 로그 버전 1.0 이상
+ Amazon Elastic Kubernetes Service(Amazon EKS) 감사 로그 버전 2.0. - Amazon EKS 감사 로그를 소스로 사용하려면 IAM 권한`ram:ListResources`에를 추가해야 합니다. 자세한 내용은 [계정에 필요한 IAM 권한 추가를 참조하세요](https://docs.aws.amazon.com//detective/latest/userguide/securitylake-integration.html#iam-permissions).

 Security Lake가 기본적으로 지원되는 AWS 서비스에서 OCSF 스키마로 오는 로그 및 이벤트를 자동으로 변환하는 방법에 대한 자세한 내용은 [Amazon Security Lake 사용 설명서를](https://docs.aws.amazon.com//security-lake/latest/userguide/open-cybersecurity-schema-framework.html) 참조하세요.

Detective를 Security Lake와 통합한 후 Detective는 AWS CloudTrail 관리 이벤트 및 Amazon VPC 흐름 로그와 관련하여 Security Lake에서 원시 로그를 가져오기 시작합니다. 자세한 내용은 [원시 로그 쿼리](https://docs.aws.amazon.com//detective/latest/userguide/profile-panel-drilldown-overall-api-volume.html#drilldown-api-volume-time-range)를 참조하세요.

# Security Lake와의 Detective 통합 활성화
<a name="integrating-securitylake-tutorial"></a>

Detective를 Security Lake와 통합하려면 다음 단계를 완료해야 합니다.

1. [시작하기 전에](https://docs.aws.amazon.com//detective/latest/userguide/securitylake-integration.html#Prerequisites)

   Organizations 관리 계정을 사용하여 조직에 대한 위임된 Security Lake 관리자를 지정해야 합니다. Security Lake가 활성화되어 있는지 확인하고 Security Lake가 AWS CloudTrail 관리 이벤트 및 Amazon Virtual Private Cloud(VPC) 흐름 로그에서 로그와 이벤트를 수집하고 있는지 확인합니다.

   보안 참조 아키텍처에 따라 Detective는 로그 아카이브 계정을 사용하고 Security Lake 배포를 위해 Security Tooling 계정 사용을 연기할 것을 권장합니다.

1. [Security Lake 구독자 생성](https://docs.aws.amazon.com//detective/latest/userguide/securitylake-integration.html#securitylake-subscriber)

   Amazon Security Lake의 로그와 이벤트를 사용하려면 Security Lake 구독자여야 합니다. Detective 계정 관리자에게 쿼리 액세스 권한을 부여하려면 다음 단계를 따르세요.

1. IAM 자격 증명에 필요한 AWS Identity and Access Management (IAM) 권한 추가.
   + 다음 권한을 추가하여 Security Lake와의 Detective 통합을 생성합니다.
     + 이러한 AWS Identity and Access Management(IAM) 권한을 IAM 자격 증명에 연결합니다. 자세한 내용은 [계정에 필요한 IAM 권한 추가 섹션을 참조하세요](https://docs.aws.amazon.com//detective/latest/userguide/securitylake-integration.html#iam-permissions).
     +  CloudFormation 서비스 역할을 전달하는 데 사용할 IAM 보안 주체에이 IAM 정책을 추가합니다. 자세한 내용은 [IAM 보안 주체에 권한 추가 섹션을 참조하세요](https://docs.aws.amazon.com//detective/latest/userguide/securitylake-integration.html#cloud-formation-template).
   + Detective를 Security Lake와 이미 통합한 경우 통합을 사용하려면 이러한 (IAM) 권한을 IAM 자격 증명에 연결합니다. 자세한 내용은 [계정에 필요한 IAM 권한 추가 섹션을 참조하세요](https://docs.aws.amazon.com//detective/latest/userguide/securitylake-integration.html#iam-permissions).

1. [리소스 공유 ARN 초대 수락 및 통합 활성화](https://docs.aws.amazon.com//detective/latest/userguide/securitylake-integration.html#resource-share-arn)

 AWS CloudFormation 템플릿을 사용하여 Security Lake 구독자의 쿼리 액세스를 생성하고 관리하는 데 필요한 파라미터를 설정합니다. 스택을 생성하는 자세한 단계는 [AWS CloudFormation 템플릿을 사용하여 스택 생성을 참조하세요](https://docs.aws.amazon.com//detective/latest/userguide/securitylake-integration.html#cloud-formation-template). 스택 생성을 완료한 후 통합을 활성화합니다.

Detective 콘솔을 사용하여 Amazon Detective를 Amazon Security Lake와 통합하는 방법에 대한 데모를 보려면 다음 비디오를 시청하세요.

[![AWS Videos](http://img.youtube.com/vi/https://www.youtube.com/embed/73ZurSZCZwA/0.jpg)](http://www.youtube.com/watch?v=https://www.youtube.com/embed/73ZurSZCZwA)


# Detective를 Security Lake와 통합하기 전에
<a name="Prerequisites"></a>

이 주제에서는 조직의 Security Lake 관리자 위임, Detective 관리자 계정에 Security Lake 활성화, Security Lake가 로그 및 이벤트를 수집하고 있는지 확인하는 등의 예비 단계를 설명합니다.

Security Lake는와 통합되어 조직의 여러 계정에서 로그 수집을 AWS Organizations 관리합니다. 조직에 Security Lake를 사용하려면 먼저 AWS Organizations 관리 계정에서 조직의 위임된 Security Lake 관리자를 지정해야 합니다. 그런 다음 위임된 Security Lake 관리자가 Security Lake를 활성화하고 조직의 멤버 계정에 대한 로그 및 이벤트 수집을 활성화해야 합니다.

Security Lake를 Detective와 통합하기 전에 Detective 관리자 계정에 대해 Security Lake가 활성화되어 있는지 확인합니다. 먼저 Security Lake 콘솔을 사용하여 Security Lake를 활성화하여 데이터 레이크 설정을 구성하고 로그 수집을 설정해야 합니다. Security Lake를 활성화하는 자세한 단계는 Amazon Security Lake 사용 설명서의 [시작하기](https://docs.aws.amazon.com//security-lake/latest/userguide/getting-started.html)를 참조하세요.

또한 Security Lake가 AWS CloudTrail 관리 이벤트 및 Amazon Virtual Private Cloud(VPC) 흐름 로그에서 로그와 이벤트를 수집하고 있는지 확인합니다. Security Lake의 로그 수집에 대한 자세한 내용은 Amazon Security Lake 사용 설명서의 [AWS 서비스에서 데이터 수집](https://docs.aws.amazon.com//security-lake/latest/userguide/internal-sources.html#cloudtrail-event-logs)을 참조하세요.

# 1단계: Detective에서 Security Lake 구독자 생성
<a name="securitylake-subscriber"></a>

이 주제에서는 Detective 콘솔을 사용하여 Security Lake 구독자를 생성하는 방법을 설명합니다.

Amazon Security Lake의 로그와 이벤트를 사용하려면 Security Lake 구독자여야 합니다. 구독자는 Security Lake가 수집하는 데이터를 쿼리하고 이에 액세스할 수 있습니다. 쿼리 액세스 권한이 있는 구독자는 Amazon Athena와 같은 서비스를 사용하여 Amazon Simple Storage Service(Amazon S3) 버킷에서 직접 AWS Lake Formation 테이블을 쿼리할 수 있습니다. 구독자가 되려면 Security Lake 관리자가 데이터 레이크를 쿼리할 수 있는 구독자 액세스 권한을 제공해야 합니다. 관리자가 이를 수행하는 방법에 대한 자세한 내용은 Amazon Security Lake 사용 설명서의 [쿼리 액세스 권한이 있는 구독자 생성](https://docs.aws.amazon.com//security-lake/latest/userguide/subscriber-query-access.html#create-query-subscriber-procedures)을 참조하세요.

다음 단계에 따라 Detective 관리자 계정에 쿼리 액세스 권한을 부여하기 위해 Security Lake 구독자를 생성합니다.

**Security Lake에서 Detective 구독자를 생성하려면**

1. [https://console.aws.amazon.com/detective/](https://console.aws.amazon.com/detective/)에서 Detective 콘솔을 엽니다.

1. 탐색 창에서 **통합**을 선택합니다.

1. Security Lake 구독자 창에서 **계정 ID** 및 **외부 ID** 값을 기록해 둡니다.

   Security Lake 관리자에게 이 ID를 사용하여 다음을 수행하도록 요청합니다.
   + Security Lake에서 Detective 구독자 생성.
   + 구독자가 쿼리 액세스 권한을 갖도록 구성.
   + Lake Formation 권한으로 Security Lake 쿼리 구독자가 생성되었는지 확인하려면 Security Lake 콘솔에서 **Lake Formation**을 **데이터 액세스 방법**으로 선택합니다.

   Security Lake 관리자가 구독자를 생성하면 Security Lake에서 Amazon 리소스 공유 ARN을 생성합니다. 관리자에게 이 ARN을 보내달라고 요청합니다.

1. **Security Lake 구독자** 창에 Security Lake 관리자가 제공한 **리소스 공유 ARN**을 입력합니다.

1. Security Lake 관리자로부터 리소스 공유 ARN을 받은 후 **Security Lake 구독자** 창의 **리소스 공유 ARN** 상자에 ARN을 입력합니다.

# 2단계: Detective에서 계정에 필요한 IAM 권한 추가
<a name="iam-permissions"></a>

이 주제에서는 IAM 자격 증명에 추가해야 하는 AWS Identity and Access Management (IAM) 권한 정책의 세부 정보를 설명합니다.

Security Lake와의 Detective 통합을 활성화하려면 다음 AWS Identity and Access Management (IAM) 권한 정책을 IAM 자격 증명에 연결해야 합니다.

다음 인라인 정책을 역할에 연결합니다. 자체 Amazon S3 버킷을 사용하여 Athena 쿼리 결과를 저장하려면 `athena-results-bucket`을 Amazon S3 버킷 이름으로 바꿉니다. Detective에서 Amazon S3 버킷을 자동으로 생성하여 Athena 쿼리 결과를 저장하도록 하려면 IAM 정책에서 전체 `S3ObjectPermissions`를 제거합니다.

이 정책을 IAM 자격 증명에 연결하는 데 필요한 권한이 없는 경우 AWS 관리자에게 문의하세요. 필요한 권한이 있지만 문제가 발생하는 경우 IAM 사용 설명서의 [액세스 거부 오류 메시지 문제 해결을](https://docs.aws.amazon.com//IAM/latest/UserGuide/troubleshoot_access-denied.html) 참조하세요.

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetBucketLocation",
                "s3:ListAllMyBuckets"
            ],
            "Resource": "*"
        },
        {
            "Sid": "S3ObjectPermissions",
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:PutObject"
            ],
            "Resource": [
                "arn:aws:s3:::amzn-s3-demo-bucket",
                "arn:aws:s3:::amzn-s3-demo-bucket/*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "glue:GetDatabases",
                "glue:GetPartitions",
                "glue:GetTable",
                "glue:GetTables"
            ],
            "Resource": [
                "arn:aws:glue:*:123456789012:database/amazon_security_lake*",
                "arn:aws:glue:*:123456789012:table/amazon_security_lake*/amazon_security_lake*",
                "arn:aws:glue:*:123456789012:catalog"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "athena:BatchGetQueryExecution",
                "athena:GetQueryExecution",
                "athena:GetQueryResults",
                "athena:GetQueryRuntimeStatistics",
                "athena:GetWorkGroup",
                "athena:ListQueryExecutions",
                "athena:StartQueryExecution",
                "athena:StopQueryExecution",
                "lakeformation:GetDataAccess",
                "ram:ListResources"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "ssm:GetParametersByPath"
            ],
            "Resource": [
                "arn:aws:ssm:*:123456789012:parameter/Detective/SLI"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "cloudformation:GetTemplateSummary",
                "iam:ListRoles"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "organizations:ListDelegatedAdministrators"
            ],
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "organizations:ServicePrincipal": [
                        "securitylake.amazonaws.com"
                    ]
                }
            }
        }
    ]
}
```

------

# 3단계: 리소스 공유 ARN 초대 수락
<a name="resource-share-arn"></a>

이 주제에서는 Security Lake와의 Detective 통합을 활성화하기 전에 필요한 단계인 AWS CloudFormation 템플릿을 사용하여 리소스 공유 ARN 초대를 수락하는 단계를 설명합니다.

Security Lake의 원시 데이터 로그에 액세스하려면 Security Lake 관리자가 생성한 Security Lake 계정의 리소스 공유 초대를 수락해야 합니다. 교차 계정 테이블 공유를 설정할 AWS Lake Formation 권한도 필요합니다. 또한 원시 쿼리 로그를 수신할 수 있는 Amazon Simple Storage Service(S3) 버킷을 생성해야 합니다.

이 다음 단계에서는 AWS CloudFormation 템플릿을 사용하여 리소스 공유 ARN 초대를 수락하고, 필요한 AWS Glue 크롤러 리소스를 생성하고, AWS Lake Formation 관리자 권한을 부여하는 스택을 생성합니다.

**리소스 공유 ARN 초대를 수락하고 통합을 활성화하려면**

1. CloudFormation 템플릿을 사용하여 CloudFormation 스택을 생성합니다. 자세한 내용은 [CloudFormation 템플릿을 사용하여 스택 생성](#cloud-formation-template) 섹션을 참조하세요.

1. 스택 생성을 완료한 후 **통합 활성화**를 선택하여 Security Lake와의 Detective 통합을 활성화합니다.

## CloudFormation 템플릿을 사용하여 스택 생성
<a name="cloud-formation-template"></a>

Detective는 Security Lake 구독자의 쿼리 액세스를 생성하고 관리하는 데 필요한 파라미터를 설정하는 데 사용할 수 있는 CloudFormation 템플릿을 제공합니다.

**1단계: AWS CloudFormation 서비스 역할 생성**

 CloudFormation 템플릿을 사용하여 스택을 생성하려면 CloudFormation 서비스 역할을 생성해야 합니다. 서비스 역할을 생성하는 데 필요한 권한이 없는 경우 Detective 관리자 계정의 관리자에게 문의합니다. AWS CloudFormation 서비스 역할에 대한 자세한 내용은 [AWS CloudFormation 서비스 역할](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-servicerole.html)을 참조하세요.

1. 에 로그인 AWS Management Console 하고 [https://console.aws.amazon.com/iam/](https://console.aws.amazon.com/iam/) IAM 콘솔을 엽니다.

1. IAM 콘솔의 탐색 창에서 **역할**을 선택하고 **역할 생성**을 선택합니다.

1. **신뢰할 수 있는 엔터티 선택(Select trusted entity)**에서 **AWS 서비스( service)**를 선택합니다.

1. **CloudFormation**을 선택합니다. 그리고 **다음**을 선택합니다.

1. 역할 이름을 입력합니다. 예를 들어 `CFN-DetectiveSecurityLakeIntegration`입니다.

1. 다음 인라인 정책을 역할에 연결합니다. 를 AWS 계정 ID`<Account ID>`로 바꿉니다.

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "CloudFormationPermission",
            "Effect": "Allow",
            "Action": [
                "cloudformation:CreateChangeSet"
            ],
            "Resource": [
                "arn:aws:cloudformation:*:aws:transform/*"
            ]
        },
        {
            "Sid": "IamPermissions",
            "Effect": "Allow",
            "Action": [
                "iam:CreateRole",
                "iam:DeleteRole",
                "iam:AttachRolePolicy",
                "iam:DetachRolePolicy",
                "iam:UpdateAssumeRolePolicy",
                "iam:PutRolePolicy",
                "iam:DeleteRolePolicy",
                "iam:CreatePolicy",
                "iam:DeletePolicy",
                "iam:PassRole",
                "iam:GetRole",
                "iam:GetRolePolicy"
            ],
            "Resource": [
                 "arn:aws:iam::111122223333:role/*-ResourceShareAcceptorLamb-*",
                 "arn:aws:iam::111122223333:role/*-SsmParametersLambdaRole-*",
                 "arn:aws:iam::111122223333:role/*-GlueDatabaseLambdaRole-*",
                 "arn:aws:iam::111122223333:role/*-GlueTablesLambdaRole-*",
                 "arn:aws:iam::111122223333:policy/*"
            ]
        },
        {
            "Sid": "S3Permissions",
            "Effect": "Allow",
            "Action": [
                "s3:CreateBucket",
                "s3:DeleteBucket*",
                "s3:PutBucket*",
                "s3:GetBucket*",
                "s3:GetObject",
                "s3:PutEncryptionConfiguration",
                "s3:GetEncryptionConfiguration"
            ],
            "Resource": [
                "arn:aws:s3:::*"
            ]
        },
        {
            "Sid": "LambdaPermissions",
            "Effect": "Allow",
            "Action": [
                "lambda:CreateFunction",
                "lambda:DeleteFunction",
                "lambda:GetFunction",
                "lambda:TagResource",
                "lambda:InvokeFunction"
            ],
            "Resource": [
                "arn:aws:lambda:*:111122223333:function:*"
            ]
        },
        {
            "Sid": "CloudwatchPermissions",
            "Effect": "Allow",
            "Action": [
                "logs:CreateLogGroup",
                "logs:DeleteLogGroup",
                "logs:DescribeLogGroups"
            ],
            "Resource": "arn:aws:logs:*:111122223333:log-group:*"
        },
        {
            "Sid": "KmsPermission",
            "Effect": "Allow",
            "Action": [
                "kms:Decrypt"
            ],
            "Resource": "arn:aws:kms:*:111122223333:key/*"
        }
    ]
}
```

------

**2단계: IAM 보안 주체에 권한 추가**.

이전 단계에서 생성한 CloudFormation 서비스 역할을 사용하여 스택을 생성하려면 다음 권한이 필요합니다. CloudFormation 서비스 역할을 전달하는 데 사용할 IAM 보안 주체에 다음 IAM 정책을 추가합니다. 스택을 생성할 때는 이 IAM 보안 주체를 수임해야 합니다. IAM 정책을 추가하는 데 필요한 권한이 없는 경우 Detective 관리자 계정의 관리자에게 문의합니다.

**참고**  
다음 정책에서 사용되는 `CFN-DetectiveSecurityLakeIntegration`은 이전 `Creating an AWS CloudFormation` 서비스 역할 단계에서 생성한 역할을 나타냅니다. 이름이 다를 경우 이전 단계에서 입력한 역할 이름으로 변경합니다.

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "PassRole",
            "Effect": "Allow",
            "Action": [
                "iam:GetRole",
                "iam:PassRole"
            ],
            "Resource": "arn:aws:iam::111122223333:role/CFN-DetectiveSecurityLakeIntegration"
        },
        {
            "Sid": "RestrictCloudFormationAccess",
            "Effect": "Allow",
            "Action": [
                "cloudformation:CreateStack",
                "cloudformation:DeleteStack",
                "cloudformation:UpdateStack"
            ],
            "Resource": "arn:aws:cloudformation:*:111122223333:stack/*",
            "Condition": {
                "StringEquals": {
                    "cloudformation:RoleArn": [
                        "arn:aws:iam::111122223333:role/CFN-DetectiveSecurityLakeIntegration"
                    ]
                }
            }
        },
        {
            "Sid": "CloudformationDescribeStack",
            "Effect": "Allow",
            "Action": [
                "cloudformation:DescribeStacks",
                "cloudformation:DescribeStackEvents",
                "cloudformation:GetStackPolicy"
            ],
            "Resource": "arn:aws:cloudformation:*:111122223333:stack/*"
        },
        {
            "Sid": "CloudformationListStacks",
            "Effect": "Allow",
            "Action": [
                "cloudformation:ListStacks"
            ],
            "Resource": "*"
        },
        {
            "Sid": "CloudWatchPermissions",
            "Effect": "Allow",
            "Action": [
                "logs:GetLogEvents"
            ],
            "Resource": "arn:aws:logs:*:111122223333:log-group:*"
        }
    ]
}
```

------

**3단계: CloudFormation 콘솔에서 사용자 지정 값 지정**

1. Detective에서 AWS CloudFormation 콘솔로 이동합니다.

1. (선택 사항) **스택 이름**을 입력합니다. 스택 이름은 자동으로 입력됩니다. 스택 이름을 기존 스택 이름과 충돌하지 않는 이름으로 변경할 수 있습니다.

1. 다음 **파라미터**를 입력합니다.
   + **AthenaResultsBucket** - 값을 입력하지 않는 경우 이 템플릿은 Amazon S3 버킷을 생성합니다. 자체 버킷을 사용하려면 Athena 쿼리 결과를 저장할 버킷 이름을 입력합니다. 자체 버킷을 사용하는 경우 버킷이 리소스 공유 ARN과 동일한 리전에 있어야 합니다. 자체 버킷을 사용하는 경우 선택한 `LakeFormationPrincipals`에 버킷에서 객체를 쓰고 읽을 수 있는 권한이 있는지 확인하세요. 버킷 권한에 대한 자세한 내용은 Amazon Athena 사용 설명서의 [쿼리 결과 및 최근 쿼리](https://docs.aws.amazon.com/athena/latest/ug/querying.html)를 참조하세요.
   + **DTRegion** - 이 필드는 미리 채워져 있습니다. 이 필드의 값은 변경하지 마세요.
   + **LakeFormationPrincipals** - Security Lake 통합을 사용할 수 있는 액세스 권한을 부여하려는 IAM 보안 주체의 ARN(예: IAM 역할 ARN)을 쉼표로 구분하여 입력합니다. 이들은 Detective를 사용하는 보안 분석가 및 보안 엔지니어일 수 있습니다.

     이전에 `Step 2: Add the required IAM permissions to your account]`단계에서 IAM 권한을 연결한 IAM 보안 주체만 사용할 수 있습니다.
   + **ResourceShareARN** - 이 필드는 미리 채워져 있습니다. 이 필드의 값은 변경하지 마세요.

1. **권한**

   **IAM 역할** - `Creating an AWS CloudFormation Service Role` 단계에서 만든 역할을 선택합니다. 현재 IAM 역할에 `Creating an AWS CloudFormation Service Role` 단계의 필수 권한이 모두 있는 경우 이 필드를 비워 둘 수도 있습니다.

1. **승인** 상자를 모두 검토하여 선택한 다음 **스택 생성** 버튼을 클릭합니다. 자세한 내용은 생성될 다음 IAM 리소스를 검토하세요.

```
* ResourceShareAcceptorCustomResourceFunction
    - ResourceShareAcceptorLambdaRole
    - ResourceShareAcceptorLogsAccessPolicy
* SsmParametersCustomResourceFunction
    - SsmParametersLambdaRole
    - SsmParametersLogsAccessPolicy
* GlueDatabaseCustomResourceFunction
    - GlueDatabaseLambdaRole
    - GlueDatabaseLogsAccessPolicy
* GlueTablesCustomResourceFunction
    - GlueTablesLambdaRole
    - GlueTablesLogsAccessPolicy
```

**4단계:의 IAM 보안 주체에 Amazon S3 버킷 정책 추가 `LakeFormationPrincipals` **

(선택 사항) 이 템플릿이 `AthenaResultsBucket`을 자동으로 생성하도록 하려면 `LakeFormationPrincipals`의 IAM 보안 주체에 다음 정책을 연결해야 합니다.

```
{
  "Sid": "S3ObjectPermissions",
  "Effect": "Allow",
  "Action": [
    "s3:GetObject",
    "s3:PutObject"
  ],
  "Resource": [
    "arn:aws:s3:::<athena-results-bucket>",
    "arn:aws:s3:::<athena-results-bucket>/*"
  ]
}
```

를 `AthenaResultsBucket` 이름으로 바꿉 `athena-results-bucket` 니다.는 AWS CloudFormation 콘솔에서 찾을 `AthenaResultsBucket` 수 있습니다.

1. [https://console.aws.amazon.com/cloudformation](https://console.aws.amazon.com/cloudformation/) CloudFormation 콘솔을 엽니다.

1. 스택을 클릭합니다.

1. **리소스** 탭을 클릭합니다.

1. 논리적 ID `AthenaResultsBucket`을 검색하고 해당 물리적 ID를 복사합니다.

# Detective 통합 구성 변경
<a name="edit-integration"></a>

Detective와 Security Lake를 통합하는 데 사용한 파라미터를 변경하려면 해당 파라미터를 편집한 다음 통합을 다시 활성화할 수 있습니다. 템플릿을 편집 CloudFormation 하여 다음 시나리오에서이 통합을 다시 활성화할 수 있습니다.
+ Security Lake 구독을 업데이트하려면 새 구독자를 만들거나 Security Lake 관리자가 기존 구독의 데이터 소스를 업데이트할 수 있습니다.
+ 원시 쿼리 로그를 저장할 다른 Amazon S3 버킷을 지정하려면
+ 다른 Lake Formation 보안 주체를 다르게 지정하려면

Security Lake와의 Detective 통합을 다시 활성화하면 **리소스 공유 ARN**을 편집하고 **IAM 권한**을 볼 수 있습니다. IAM 권한을 편집하려면 Detective에서 IAM 콘솔로 이동할 수 있습니다. CloudFormation 템플릿에 이전에 입력한 값을 편집할 수도 있습니다. 통합을 다시 활성화하려면 기존 CloudFormation 스택을 삭제하고 다시 생성해야 합니다.

**Security Lake와의 Detective 통합을 다시 활성화하려면**

1. [https://console.aws.amazon.com/detective/](https://console.aws.amazon.com/detective/)에서 Detective 콘솔을 엽니다.

1. 탐색 창에서 **통합**을 선택합니다.

1. 다음 단계 중 하나를 사용하여 통합을 편집할 수 있습니다.
   + **Security Lake** 창에서 **편집**을 선택합니다.
   + **Security Lake** 창에서 **보기**를 선택합니다. 보기 창에서 **편집**을 선택합니다.

1. 새 **리소스 공유 ARN**을 입력하여 리전의 데이터 소스에 액세스합니다.

1. 현재 IAM 권한을 확인하고 IAM 권한을 편집하려면 IAM 콘솔로 이동합니다.

1. CloudFormation 템플릿에서 값을 편집합니다.

   1. 새 스택을 생성하기 전에 먼저 기존 스택을 삭제합니다. 기존 스택을 삭제하지 않고 동일한 리전에 새 스택을 생성하려고 하면 요청이 실패합니다. 자세한 내용은 [CloudFormation 스택 삭제](disable-integration.md#delete-stack) 섹션을 참조하세요.

   1. 새 CloudFormation 스택을 생성합니다. 자세한 내용은 [CloudFormation 템플릿을 사용하여 스택 생성](resource-share-arn.md#cloud-formation-template) 섹션을 참조하세요.

1. **통합 활성화**를 선택합니다.

# Detective를 Security Lake와 통합하는 데 지원되는 AWS 리전
<a name="supported-regions"></a>

다음 AWS 리전에서 Detective를 Security Lake와 통합할 수 있습니다.


****  

| 리전 이름 | 리전 | 엔드포인트 | 프로토콜 | 
| --- | --- | --- | --- | 
| 미국 동부(오하이오) | us-east-2 |  securitylake.us-east-2.amazonaws.com  | HTTPS | 
| 미국 동부(버지니아 북부) | us-east-1 |  securitylake.us-east-1.amazonaws.com  | HTTPS | 
| 미국 서부(캘리포니아 북부) | us-west-1 |  securitylake.us-west-1.amazonaws.com  | HTTPS | 
| 미국 서부(오레곤) | us-west-2 |  securitylake.us-west-2.amazonaws.com  | HTTPS | 
| 아시아 태평양(뭄바이) | ap-south-1 |  securitylake.ap-south-1.amazonaws.com  | HTTPS | 
| 아시아 태평양(서울) | ap-northeast-2 |  securitylake.ap-northeast-2.amazonaws.com  | HTTPS | 
| 아시아 태평양(싱가포르) | ap-southeast-1 |  securitylake.ap-southeast-1.amazonaws.com  | HTTPS | 
| 아시아 태평양(시드니) | ap-southeast-2 |  securitylake.ap-southeast-2.amazonaws.com  | HTTPS | 
| 아시아 태평양(도쿄) | ap-northeast-1 |  securitylake.ap-northeast-1.amazonaws.com  | HTTPS | 
| 캐나다(중부) | ca-central-1 |  securitylake.ca-central-1.amazonaws.com  | HTTPS | 
| 유럽(프랑크푸르트) | eu-central-1 |  securitylake.eu-central-1.amazonaws.com  | HTTPS | 
| 유럽(아일랜드) | eu-west-1 |  securitylake.eu-west-1.amazonaws.com  | HTTPS | 
| 유럽(런던) | eu-west-2 |  securitylake.eu-west-2.amazonaws.com  | HTTPS | 
| 유럽(파리) | eu-west-3 |  securitylake.eu-west-3.amazonaws.com  | HTTPS | 
| 유럽(스톡홀름) | eu-north-1 |  securitylake.eu-north-1.amazonaws.com  | HTTPS | 
| 남아메리카(상파울루) | sa-east-1 |  securitylake.sa-east-1.amazonaws.com  | HTTPS | 

# Detective에서 원시 로그 쿼리
<a name="query-raw-logs-detective"></a>

Detective를 Security Lake와 통합한 후 Detective는 AWS CloudTrail 관리 이벤트 및 Amazon Virtual Private Cloud(VPC) 흐름 로그와 관련하여 Security Lake에서 원시 로그를 가져오기 시작합니다.

**참고**  
Detective에서 원시 로그를 쿼리하는 데 대한 추가 비용은 없습니다. Amazon Athena를 포함한 다른 AWS 서비스에 대한 사용 요금은 여전히 게시된 요금으로 적용됩니다.

AWS CloudTrail 관리 이벤트는 다음 프로파일에 사용할 수 있습니다.
+ AWS 계정
+ AWS 사용자
+ AWS 역할
+ AWS 역할 세션
+ Amazon EC2 인스턴스
+ Amazon S3 버킷
+ IP 주소
+ Kubernetes 클러스터
+ Kubernetes 포드
+ Kubernetes 제목
+ IAM 역할
+ IAM 역할 세션
+ IAM 사용자

Amazon VPC Flow 로그는 다음 프로필에 사용할 수 있습니다.
+ Amazon EC2 인스턴스
+ Kubernetes 포드

Detective 콘솔을 사용하여 Amazon Security Lake에서 Amazon Detective를 사용하는 방법에 대한 데모를 보려면 다음 동영상을 시청하세요.

[![AWS Videos](http://img.youtube.com/vi/https://www.youtube.com/embed/A_EWd2lvVW0/0.jpg)](http://www.youtube.com/watch?v=https://www.youtube.com/embed/A_EWd2lvVW0)


**AWS 계정의 원시 로그를 쿼리하려면**

1. [https://console.aws.amazon.com/detective/](https://console.aws.amazon.com/detective/)에서 Detective 콘솔을 엽니다.

1. 탐색 창에서 **검색**을 선택한 후 `AWS account`을 검색합니다.

1. **전체 API 호출 볼륨** 섹션에서 **범위 시간에 대한 세부 정보 표시**를 선택합니다.

1. 여기에서 **원시 로그 쿼리**를 시작할 수 있습니다.

![\[원시 로그 미리 보기 테이블을 통해 Security Lake에서 데이터를 쿼리하여 검색한 로그 및 이벤트를 볼 수 있습니다. 원시 이벤트 로그에 대한 자세한 내용은 Amazon Athena에 표시된 데이터를 참조하세요.\]](http://docs.aws.amazon.com/ko_kr/detective/latest/userguide/images/query-raw-logs-awsaccount.png)


**원시 로그 미리 보기** 테이블을 통해 Security Lake에서 데이터를 쿼리하여 검색한 로그 및 이벤트를 볼 수 있습니다. 원시 이벤트 로그에 대한 자세한 내용은 Amazon Athena에 표시된 데이터를 참조하세요.

![\[원시 로그 미리 보기 테이블을 통해 Security Lake에서 데이터를 쿼리하여 검색한 로그 및 이벤트를 볼 수 있습니다. 원시 이벤트 로그에 대한 자세한 내용은 Amazon Athena에 표시된 데이터를 참조하세요.\]](http://docs.aws.amazon.com/ko_kr/detective/latest/userguide/images/query-raw-log-table.png)


원시 로그 쿼리 테이블에서 **쿼리 요청을 취소**하고, **Amazon Athena에서 결과를 확인**하고, 결과를 쉼표로 구분된 값(.csv) 파일로 **다운로드**할 수 있습니다.

Detective에 로그가 표시되지만 쿼리 결과가 반환되지 않는 경우 다음과 같은 이유 때문일 수 있습니다.
+ 원시 로그는 Security Lake 로그 테이블에 표시되기 전에 Detective에 제공될 수 있습니다. 나중에 다시 시도해 주세요.
+ Security Lake에서 로그가 누락되었을 수 있습니다. 오랜 시간 기다린 경우 Security Lake에서 로그가 누락된 것으로 표시됩니다. Security Lake 관리자에게 문의하여 이 문제를 해결하세요.

**Topics**
+ [AWS 역할에 대한 원시 로그 쿼리](#query-log-geo-location)
+ [Amazon EKS 클러스터에 대한 원시 로그 쿼리](#query-log-eks-cluster)
+ [Amazon EC2 인스턴스에 대한 원시 로그 쿼리](#query-log-vpc)

## AWS 역할에 대한 원시 로그 쿼리
<a name="query-log-geo-location"></a>

새 지리적 위치에서 AWS 역할의 활동을 이해하려면 Detective 콘솔에서 수행할 수 있습니다.



**AWS 역할의 원시 로그를 쿼리하려면**

1. [https://console.aws.amazon.com/detective/](https://console.aws.amazon.com/detective/)에서 Detective 콘솔을 엽니다.

1. 탐지 **요약** 페이지에서 **새로 관찰된 지리적 위치** 섹션에서 AWS 역할을 기록해 둡니다.

1. 탐색 창에서 **검색**을 선택한 후 `AWS role`을 검색합니다.

1.  AWS 역할의 경우 리소스를 확장하여 해당 리소스가 해당 IP 주소에서 실행한 특정 API 호출을 표시합니다.

1. 조사하려는 API 호출 옆의 돋보기 아이콘을 선택하여 **원시 로그 미리 보기** 테이블을 엽니다.  
![\[원시 로그 미리 보기 테이블을 통해 Security Lake에서 데이터를 쿼리하여 검색한 로그 및 이벤트를 볼 수 있습니다. 원시 이벤트 로그에 대한 자세한 내용은 Amazon Athena에 표시된 데이터를 참조하세요.\]](http://docs.aws.amazon.com/ko_kr/detective/latest/userguide/images/query-raw-logs-awsrole.png)

## Amazon EKS 클러스터에 대한 원시 로그 쿼리
<a name="query-log-eks-cluster"></a>

1. [https://console.aws.amazon.com/detective/](https://console.aws.amazon.com/detective/)에서 Detective 콘솔을 엽니다.

1. **생성된 포드가 가장 많은 컨테이너 클러스터** 감지 **요약** 페이지에서 Amazon EKS 클러스터로 이동합니다.

1. **Amazon EKS 클러스터 세부 정보** 페이지에서 **Kubernetes API 활동** 탭을 선택합니다.

1. **이 Amazon EKS 클러스터와 관련된 전체 Kubernetes API 활동** 섹션에서 **범위 시간에 대한 세부 정보 표시를** 선택합니다.

1. 여기에서 **원시 로그 쿼리**를 시작할 수 있습니다.

## Amazon EC2 인스턴스에 대한 원시 로그 쿼리
<a name="query-log-vpc"></a>



1. [https://console.aws.amazon.com/detective/](https://console.aws.amazon.com/detective/)에서 Detective 콘솔을 엽니다.

1. 탐색 창에서 **검색**을 선택한 후 `Amazon EC2 instance`을 검색합니다.

1. **전체 VPC 흐름 볼륨** 섹션에서 조사하려는 API 직접 호출 옆의 돋보기 아이콘을 선택하여 **원시 로그 미리 보기** 테이블을 엽니다.

1. 여기에서 **원시 로그 쿼리**를 시작할 수 있습니다.  
![\[원시 로그 미리 보기 테이블을 통해 Security Lake에서 데이터를 쿼리하여 검색한 로그 및 이벤트를 볼 수 있습니다. 원시 이벤트 로그에 대한 자세한 내용은 Amazon Athena에 표시된 데이터를 참조하세요.\]](http://docs.aws.amazon.com/ko_kr/detective/latest/userguide/images/query-raw-log-vpc.png)

**원시 로그 미리 보기** 테이블을 통해 Security Lake에서 데이터를 쿼리하여 검색한 로그 및 이벤트를 볼 수 있습니다. 원시 이벤트 로그에 대한 자세한 내용은 Amazon Athena에 표시된 데이터를 참조하세요.

원시 로그 쿼리 테이블에서 **쿼리 요청을 취소**하고, **Amazon Athena에서 결과를 확인**하고, 결과를 쉼표로 구분된 값(.csv) 파일로 **다운로드**할 수 있습니다.

# Security Lake와의 Detective 통합 비활성화
<a name="disable-integration"></a>

Security Lake와의 Detective 통합을 비활성화하면 더 이상 Security Lake에서 로그 및 이벤트 데이터를 쿼리할 수 없습니다.

**Security Lake와의 Detective 통합을 비활성화하려면**

1. [https://console.aws.amazon.com/detective/](https://console.aws.amazon.com/detective/)에서 Detective 콘솔을 엽니다.

1. 탐색 창에서 **통합**을 선택합니다.

1. 기존 스택을 삭제합니다. 자세한 내용은 [CloudFormation 스택 삭제](#delete-stack) 섹션을 참조하세요.

1. **Security Lake 통합 비활성화** 창에서 **비활성화**를 선택합니다.

## CloudFormation 스택 삭제
<a name="delete-stack"></a>

기존 스택을 삭제하지 않으면 동일한 리전에서 새 스택을 생성할 수 없습니다. CloudFormation 콘솔을 사용하거나 AWS CLI를 사용하여 CloudFormation 스택을 삭제할 수 있습니다.

**CloudFormation 스택을 삭제하려면(콘솔)**

1. [https://console.aws.amazon.com/cloudformation](https://console.aws.amazon.com/cloudformation/) AWS CloudFormation 콘솔을 엽니다.

1. CloudFormation 콘솔의 [**스택(Stacks)**] 페이지에서 삭제할 스택을 선택합니다. 스택이 현재 실행 중이어야 합니다.

1. 스택 세부 정보 창에서 **삭제**를 선택합니다.

1. 메시지가 나타나면 **스택 삭제**를 선택합니다.
**참고**  
스택 삭제가 시작된 후에는 스택 삭제 작업을 중지할 수 없습니다. 스택이 `DELETE_IN_PROGRESS` 상태로 바뀝니다.

스택 삭제가 완료되면 스택의 상태가 `DELETE_COMPLETE`로 바뀝니다.

**스택 삭제 오류 문제 해결**

`Delete` 버튼을 클릭한 후 `Failed to delete stack` 메시지와 함께 권한 오류가 표시되는 경우, IAM 역할에 스택을 삭제할 CloudFormation 권한이 없는 것입니다. 계정 관리자에게 문의하여 스택을 삭제합니다.

**CloudFormation 스택을 삭제하려면(AWS CLI)**

 AWS CLI 인터페이스에 다음 명령을 입력합니다.

```
aws cloudformation delete-stack --stack-name your-stack-name --role-arn
      arn:aws:iam::<ACCOUNT ID>:role/CFN-DetectiveSecurityLakeIntegration
```

`CFN-DetectiveSecurityLakeIntegration`은 `Creating an AWS CloudFormation Service Role`단계에서 생성한 서비스 역할입니다.