AMS Accelerate 계정의 변경 사항 추적 - AMS Accelerate 사용 설명서

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

AMS Accelerate 계정의 변경 사항 추적

중요

Change Record 서비스는 2025년 7월 1일부터 더 이상 사용되지 않습니다.

새 계정은 변경 레코드 서비스에 온보딩할 수 없습니다.

AMS Accelerate 계정에서 CloudTrail 데이터를 쿼리하려면 다음 서비스를 사용할 수 있습니다.

  • 에서 이벤트 기록을 AWS CloudTrail선택하고 조회 속성을 사용하여 이벤트를 필터링합니다. 시간 범위 필터를 사용하여 s3.amazon.aws.com 지정된의 이벤트 소스별로 이벤트 기록을 필터링하거나 사용자 이름별로 이벤트 기록을 필터링하도록 선택할 수 있습니다. 자세한 내용은 CloudTrail 이벤트 기록 작업을 참조하세요.

  • AWS CloudTrail Lake를 사용하여 쿼리를 통해 데이터를 수집합니다. 에서 Lake를 AWS CloudTrail 선택한 다음 Query를 선택합니다. 자체 쿼리를 생성하거나, 쿼리 생성기를 사용하거나, 샘플 쿼리를 사용하여 이벤트 기반 데이터를 수집할 수 있습니다. 예를 들어 지난 주에 Amazon EC2 인스턴스를 삭제한 사람에게 질문할 수 있습니다. 자세한 내용은 AWS CloudTrail 소스에서 데이터 레이크 생성CloudTrailLake 쿼리를 참조하세요.

  • 에서 Amazon Athena 테이블을 생성하고 스토리지 위치를 추적 AWS CloudTrail 과 연결된 Amazon S3 버킷으로 설정합니다. 추적과 Amazon S3 버킷의 홈 리전이 동일한지 확인합니다. Amazon Athena에서 쿼리 편집기를 사용하여 Accelerate가 Athena 콘솔과 함께 사용하기 위해 제공하는 기본 쿼리를 실행합니다. CloudTrail 로그를 쿼리하기 위해에 Athena 테이블을 생성하는 방법에 대한 자세한 내용은 쿼리 AWS CloudTrail 로그를 참조하세요.

AWS Managed Services는 Amazon Athena(Athena) 콘솔 및 AMS Accelerate 로그 관리를 사용하여 쿼리 가능한 인터페이스를 제공하여 AMS Accelerate Operations 팀 및 AMS Accelerate 자동화의 변경 사항을 추적하는 데 도움이 됩니다.

Athena는 표준 구조화 쿼리 언어(SQL)를 사용하여 Amazon S3의 데이터를 분석하는 데 사용할 수 있는 대화형 쿼리 서비스입니다(Amazon Athena용 SQL 참조 참조). Athena는 서버리스 서비스이므로 관리할 인프라가 없으며 실행한 쿼리에 대해서만 비용을 지불하면 됩니다. AMS Accelerate는 CloudTrail 로그를 통해 일일 파티션이 있는 Athena 테이블을 생성하고 기본 AWS 리전 및 ams-change-record 작업 그룹 내에서 쿼리를 제공합니다. 기본 쿼리 중 하나를 선택하고 필요에 따라 실행할 수 있습니다. Athena 작업 그룹에 대한 자세한 내용은 작업 그룹 작동 방식을 참조하세요.

참고

조직 관리자가 온보딩 중에 계정의 CloudTrail 이벤트를 쿼리하고 분석하기 위해 Athena를 사용하기 위한 IAM 역할을 배포하지 않는 한 CloudTrail Accelerate만 Athena를 사용하여 Accelerate에 대한 CloudTrail 이벤트를 쿼리할 수 있습니다.

변경 레코드를 사용하면 다음과 같은 질문에 쉽게 답할 수 있습니다.

  • (AMS Accelerate Systems 또는 AMS Accelerate Operators)가 계정에 액세스한 사용자

  • 계정에서 AMS Accelerate가 변경한 사항

  • AMS Accelerate가 계정에서 변경을 수행한 시기

  • 계정의 변경 사항을 볼 수 있는 위치

  • AMS Accelerate가 계정에서 변경해야 하는 이유

  • 쿼리를 수정하여 비 AMS 변경 사항에 대한 모든 질문에 대한 답변을 얻는 방법

변경 레코드 보기

Athena 쿼리를 사용하려면 AWS 관리 콘솔에 로그인하고 기본 AWS 리전의 Athena 콘솔로 이동합니다.

참고

단계를 수행하는 동안 Amazon Athena 시작하기 페이지가 표시되면 시작하기를 클릭합니다. 이는 변경 레코드 인프라가 이미 마련되어 있는 경우에도 나타날 수 있습니다.

  1. Athena 콘솔의 상단 탐색 패널에서 작업 그룹을 선택합니다.

  2. ams-change-record 작업 그룹을 선택한 다음 작업 그룹 전환을 클릭합니다.

  3. 데이터베이스 콤보 상자에서 ams-change-record-database를 선택합니다. ams-change-record-database에는 ams-change-record-table 테이블이 포함되어 있습니다.

  4. 상단 탐색 패널에서 저장된 쿼리를 선택합니다.

  5. 저장된 쿼리 창에는 AMS Accelerate가 제공하는 쿼리 목록이 표시되며,이 쿼리를 실행할 수 있습니다. 저장된 쿼리 목록에서 실행할 쿼리를 선택합니다. 예를 들어 ams_session_accesses_v1 쿼리입니다.

    사전 설정된 AMS Accelerate 쿼리의 전체 목록은 섹션을 참조하세요기본 쿼리.

  6. 필요에 따라 쿼리 편집기 상자에서 날짜/시간 필터를 조정합니다. 기본적으로 쿼리는 마지막 날의 변경 사항만 확인합니다.

  7. 쿼리 실행을 선택합니다.

기본 쿼리

AMS Accelerate는 Athena 콘솔 내에서 사용할 수 있는 몇 가지 기본 쿼리를 제공합니다. 기본 쿼리는 다음 표에 나열되어 있습니다.

참고
  • 모든 쿼리는 날짜/시간 범위를 선택적 필터로 수락합니다. 모든 쿼리는 기본적으로 지난 24시간 동안 실행됩니다. 예상 입력은 다음 하위 섹션인 단원을 참조하십시오쿼리에서 날짜/시간 필터 수정.

  • 변경할 수 있거나 변경해야 하는 파라미터 입력은 쿼리에 각진 중괄호와 함께 <PARAMETER_NAME>으로 표시됩니다. 자리 표시자와 각형 중괄호를 파라미터 값으로 바꿉니다.

  • 모든 필터는 선택 사항입니다. 쿼리에서 일부 선택적 필터는 줄 시작 부분에 이중 대시(--)로 주석 처리됩니다. 모든 쿼리는 기본 파라미터와 함께 쿼리 없이 실행됩니다. 이러한 선택적 필터에 파라미터 값을 지정하려면 줄의 시작 부분에서 이중 대시(--)를 제거하고 원하는 대로 파라미터를 바꿉니다.

  • 모든 쿼리는 출력IAM SessionId에서 IAM PincipalId 및를 반환합니다.

  • 쿼리 실행에 대해 계산된 비용은 계정에 대해 생성되는 CloudTrail 로그 수에 따라 달라집니다. 비용을 계산하려면 AWS Athena 요금 계산기를 사용합니다.

미리 준비된 쿼리
용도/설명 입력 결과

쿼리 이름: ams_access_session_query_v1

AMS Accelerate 액세스 세션 추적

특정 AMS Accelerate 액세스 세션에 대한 정보를 제공합니다. 쿼리는 IAM 보안 주체 ID를 선택적 필터로 수락하고 이벤트 시간, 계정 액세스에 대한 비즈니스 요구 사항, 요청자 등을 반환합니다.

줄의 주석 처리를 취소하고 자리 표시자 IAM PrincipalId를 쿼리 편집기의 특정 ID로 대체하여 특정 IAM PrincipalId 주체 ID를 기준으로 필터링할 수 있습니다.

쿼리의 WHERE 절에서 useragent 필터 줄을 제거하여 비 AMS 액세스 세션을 나열할 수도 있습니다.

(선택 사항) IAM PrincipalId: 액세스하려는 리소스의 IAM 보안 주체 식별자입니다. 형식은 UNIQUE_IDENTIFIER:RESOURCE_NAME입니다. 자세한 내용은 고유 식별자를 참조하세요. 이 필터 없이 쿼리를 실행하여 필터링하려는 정확한 IAM PrincipalId를 확인할 수 있습니다.

  • EventTime: 액세스 권한을 얻는 시간

  • EventName: AWS 이벤트 이름(AssumeRole)

  • EventRegion: 요청을 가져오는 AWS 리전

  • EventId: CloudTrail 이벤트 ID

  • BusinessNeed 유형: 계정에 액세스하기 위한 비즈니스 사유 유형입니다. 허용되는 값은 SupportCase, OpsItem, Issue, Text입니다.

  • BusinessNeed: 비즈니스에서 계정에 액세스해야 합니다. 지원 사례 ID, 운영 항목 ID 등을 예로 들 수 있습니다.

  • 요청자: 계정에 액세스하는 운영자 ID 또는 계정에 액세스하는 자동화 시스템입니다.

  • RequestAccessType: 요청자 유형(시스템, OpsConsole, OpsAPI, Unset)

쿼리 이름: ams_events_query_v1

AMS Accelerate에서 수행한 모든 변경 작업 추적

해당 AMS Accelerate 역할 필터를 사용하여 계정에서 수행된 모든 쓰기 작업을 반환합니다.

쿼리의 WHERE 절에서 useridentity.arn 필터 라인을 제거하여 비 AMS 역할이 수행한 변경 작업을 추적할 수도 있습니다.

(선택 사항)

날짜/시간 범위만 해당됩니다. 쿼리에서 날짜/시간 필터 수정을(를) 참조하세요.

  • AccountId: AWS 계정 ID

  • RoleArn: 요청자의 RoleArn

  • EventTime: 액세스 권한을 얻는 시간

  • EventName: AWS 이벤트 이름(AssumeRole)

  • EventRegion: 요청을 가져오는 AWS 리전

  • EventId: CloudTrail 이벤트 ID

  • RequestParameters: 요청에 대한 요청 파라미터

  • ResponseElements: 응답에 대한 응답 요소입니다.

  • UserAgent: AWS CloudTrail 사용자 에이전트

쿼리 이름: ams_instance_access_sessions_query_v1

AMS Accelerate로 인스턴스 액세스 추적

AMS Accelerate 인스턴스 액세스 목록을 반환합니다. 모든 레코드에는 이벤트 시간, 이벤트 리전, 인스턴스 ID, IAM 보안 주체 ID, IAM 세션 ID, SSM 세션 ID가 포함됩니다. IAM 보안 주체 ID를 사용하여 ams_access_sessions_query_v1 Athena 쿼리를 사용하여 인스턴스에 액세스하는 데 필요한 비즈니스 요구 사항에 대한 자세한 정보를 얻을 수 있습니다. SSM 세션 ID를 사용하여 세션의 시작 및 종료 시간, 로그 세부 정보, 인스턴스 AWS 리전의 AWS Session Manager 콘솔 사용 등 인스턴스 액세스 세션에 대한 자세한 정보를 얻을 수 있습니다.

사용자는 쿼리의 WHERE 절에서 사용자 ID 필터 줄을 제거하여 비 AMS 인스턴스 액세스를 나열할 수도 있습니다.

datetime range만 해당합니다. 쿼리에서 날짜/시간 필터 수정을(를) 참조하세요.

  • InstanceId: 인스턴스 ID

  • SSMSession ID: SSM 세션 ID

  • RoleArn: 요청자의 RoleArn

  • EventTime: 액세스 권한을 얻는 시간

  • EventName: AWS 이벤트 이름(AssumeRole)

  • EventRegion: 요청을 가져오는 AWS 리전

  • EventId: CloudTrail 이벤트 ID

쿼리 이름: ams_privilege_escalation_events_query_v1

AMS 및 비 AMS 사용자에 대한 권한(에스컬레이션) 이벤트 추적

권한 에스컬레이션으로 직접 또는 잠재적으로 이어질 수 있는 이벤트 목록을 제공합니다. 쿼리는 ActionedBy를 선택적 필터로 수락하고 EventName, EventId, EventTime 등을 반환합니다. 이벤트와 연결된 모든 필드도 반환됩니다. 해당 이벤트에 해당하지 않는 경우 필드는 비어 있습니다. ActionedBy 필터는 기본적으로 비활성화되어 있습니다. 활성화하려면 해당 줄에서 "-- "를 제거합니다.

기본적으로 ActionedBy 필터는 비활성화되어 있습니다(모든 사용자의 권한 에스컬레이션 이벤트가 표시됨). 특정 사용자 또는 역할에 대한 이벤트를 표시하려면 WHERE 절의 사용자 ID 필터 줄에서 이중 대시(--)를 제거하고 자리 표시자 ACTIONEDBY_PUT_USER_NAME_HERE를 IAM 사용자 또는 역할 이름으로 바꿉니다. 필터 없이 쿼리를 실행하여 필터링할 정확한 사용자를 결정할 수 있습니다.

(선택 사항) ACTIONEDBY_PUT_USER_NAME: actionedBy 사용자의 사용자 이름입니다. 이는 IAM 사용자 또는 역할일 수 있습니다. 예를 들어 ams-access-admin입니다.

(선택 사항) datetime range. 쿼리에서 날짜/시간 필터 수정을(를) 참조하세요.

  • AccountId: 계정 ID

  • ActionedBy: ActionedBy 사용자 이름

  • EventTime: 액세스 권한을 얻는 시간

  • EventName: AWS 이벤트 이름(AssumeRole).

  • EventRegion: 요청을 가져오는 AWS 리전

  • EventId: CloudTrail 이벤트 ID

쿼리 이름: ams_resource_events_query_v1

특정 리소스 AMS 또는 비 AMS에 대한 쓰기 이벤트 추적

특정 리소스에서 수행된 이벤트 목록을 제공합니다. 쿼리는 필터의 일부로 리소스 ID를 수락하고(쿼리의 WHERE 절에서 자리 표시자 RESOURCE_INFO 대체) 해당 리소스에 대해 수행된 모든 쓰기 작업을 반환합니다.

(필수) RESOURCE_INFO: 리소스 식별자는 계정의 모든 AWS 리소스에 대한 ID일 수 있습니다. 리소스 ARNs과 혼동하지 마세요. 예를 들어 EC2 인스턴스의 인스턴스 ID, DynamoDB 테이블의 테이블 이름, CloudWatch Log의 logGroupName 등이 있습니다.

(선택 사항) datetime range. 쿼리에서 날짜/시간 필터 수정을(를) 참조하세요.

  • AccountId: 계정 ID

  • ActionedBy: ActionedBy 사용자 이름

  • EventTime: 액세스 권한을 얻는 시간

  • EventName: AWS 이벤트 이름(AssumeRole).

  • EventRegion: 요청을 가져오는 AWS 리전

  • EventId: CloudTrail 이벤트 ID

쿼리 이름: ams_session_events_query_v1

특정 세션 동안 AMS Accelerate에서 수행한 쓰기 작업 추적

특정 세션에서 수행된 이벤트 목록을 제공합니다. 쿼리는 필터의 일부로 IAM 보안 주체 ID를 수락하고(쿼리의 WHERE 절에서 자리 표시자 PRINCIPAL_ID 대체) 해당 리소스에 대해 수행된 모든 쓰기 작업을 반환합니다.

(필수) PRINCIPAL_ID: 세션의 보안 주체 ID입니다. 형식은 UNIQUE_IDENTIFIER:RESOURCE_NAME입니다. 자세한 내용은 고유 식별자를 참조하세요. 쿼리 "ams_session_ids_by_requester_v1"을 실행하여 요청자의 IAM 보안 주체 IDs 있습니다. 이 필터 없이 쿼리를 실행하여 필터링할 정확한 IAM PrincipalId를 결정할 수도 있습니다.

(선택 사항) datetime range. 쿼리에서 날짜/시간 필터 수정을(를) 참조하세요.

  • AccountId: 계정 ID

  • ActionedBy: ActionedBy 사용자 이름

  • EventTime: 액세스 권한을 얻는 시간

  • EventName: AWS 이벤트 이름(AssumeRole)

  • EventRegion: 요청을 가져오는 AWS 리전

  • EventId: CloudTrail 이벤트 ID

쿼리 이름: ams_session_ids_by_requester_v1

특정 요청자의 IAM 보안 주체/세션 IDs.

쿼리는 "requester"(쿼리의 WHERE 절에서 자리 표시자 요청자 대체)를 수락하고 지정된 시간 범위 동안 해당 요청자가 모든 IAM 보안 주체 ID를 반환합니다.

(필수) Requester: 계정에 액세스하는 연산자 ID(예: 연산자의 별칭) 또는 계정에 액세스하는 자동화 시스템(예: OsConfiguration, AlarmManager 등).

(선택 사항) datetime range. 쿼리에서 날짜/시간 필터 수정을(를) 참조하세요.

  • IAM PrincipalId - 세션의 IAM Principal Id입니다. 형식은 UNIQUE_IDENTIFIER:RESOURCE_NAME입니다. 자세한 내용은 고유 식별자를 참조하세요. 이 필터 없이 쿼리를 실행하여 필터링할 정확한 IAM PrincipalId를 결정할 수 있습니다.

  • IAM SessionId - 액세스 세션의 IAM 세션 ID

  • EventTime: 액세스 권한을 얻는 시간

쿼리에서 날짜/시간 필터 수정

모든 쿼리는 날짜/시간 범위를 선택적 필터로 허용합니다. 모든 쿼리는 기본적으로 지난 1일 동안 실행됩니다.

날짜/시간 필드에 사용되는 형식은 yyyy/MM/dd(예: 2021/01/01)입니다. 날짜만 저장하고 전체 타임스탬프는 저장하지 않습니다. 전체 타임스탬프의 경우 ISO 8601 형식 yyyy-MM-ddT HH:mm:ssZ(예: 2021-01-01T23:59:59Z)로 타임스탬프를 저장하는 필드 eventime을 사용합니다. 그러나 테이블은 날짜/시간 필드에 분할되므로 날짜/시간 필터와 이벤트/시간 필터를 모두 쿼리에 전달해야 합니다. 다음 예시를 참조하세요.

참고

범위를 수정할 수 있는 허용되는 모든 방법을 보려면 현재 날짜 및 시간 함수 및 연산자에 사용되는 Athena 엔진 버전을 기반으로 하는 최신 Presto 함수 설명서를 참조하여 범위를 수정할 수 있는 허용되는 모든 방법을 확인하세요.

날짜 수준: 지난 1일 또는 지난 24시간(기본값) 예: CURRENT_DATE='2021/01/01' 인 경우 필터는 현재 날짜에서 하루를 빼서 날짜/시간 > '2020/12/31'로 형식을 지정합니다.

datetime > date_format(date_add('day', - 1, CURRENT_DATE), '%Y/%m/%d')

날짜 수준: 지난 2개월 예:

datetime > date_format(date_add('month', - 2, CURRENT_DATE), '%Y/%m/%d')

날짜 수준: 2일 사이 예:

datetime > '2021/01/01' AND datetime < '2021/01/10'

타임스탬프 수준: 지난 12시간 예:

스캔한 파티션 데이터는 1일 동안 지속된 다음 지난 12시간 내의 모든 이벤트를 필터링합니다.

datetime > date_format(date_add('day', - 1, CURRENT_DATE), '%Y/%m/%d') AND eventtime > date_format(date_add('hour', - 12, CURRENT_TIMESTAMP), '%Y-%m-%dT%H:%i:%sZ')

타임스탬프 수준: 2개 사이의 타임스탬프 예:

2021년 1월 1일 오후 12시에서 2021년 1월 10일 오후 3시 사이에 이벤트를 가져옵니다.

datetime > '2021/01/01' AND datetime < '2021/01/10' AND eventtime > '2021-01-01T12:00:00Z' AND eventtime < '2021-01-10T15:00:00Z'

기본 쿼리 예제

Name: ams_access_session_query_v1 Description: >- The query provides more information on specific AMS access session. The query accepts IAM Principal Id as an optional filter and returns event time, business need for accessing the account, requester, ... etc. By default; the query filter last day events only, the user can change the datetime filter to search for more wide time range. By default; the IAM PrincipalId filter is disabled. To enable it, remove "-- " from that line. AthenaQueryString: |- /* The query provides list of AMS access sessions during specific time range. The query accepts IAM Principal Id as an optional filter and returns event time, business need for accessing the account, requester, ... etc. By default, the query filters the last day's events only; you can change the "datetime" filter to search for a wider time range. By default; the IAM Principal ID filter is disabled (it shows access sessions for all IAM principals). If you want to only show access sessions for a particular IAM principal ID, remove the double-dash (--) from the "IAM Principal ID" filter line in the WHERE clause of the query, and replace the placeholder "<IAM PrincipalId>" with the specific ID that you want. You can run the query without the filter to determine the exact IAM PrincipalId you want to filter with. By default; the query only shows AMS access sessions. If you also want to show non-AMS access sessions, remove the "useragent" filter in the WHERE clause of the query. For expected inputs and scenarios, refer to AMS Documentation -> Tracking changes in your AMS Accelerate accounts -> Default Queries */ SELECT json_extract_scalar(responseelements, '$.assumedRoleUser.assumedRoleId') AS "IAM PrincipalId", json_extract_scalar(responseelements, '$.credentials.accessKeyId') AS "IAM SessionId", eventtime AS "EventTime", eventname AS "EventName", awsregion AS "EventRegion", eventid AS "EventId", json_extract_scalar(requestparameters, '$.tags[0].value') AS "BusinessNeed", json_extract_scalar(requestparameters, '$.tags[1].value') AS "BusinessNeedType", json_extract_scalar(requestparameters, '$.tags[2].value') AS "Requester", json_extract_scalar(requestparameters, '$.tags[3].value') AS "AccessRequestType" FROM "{DATABASE NAME HERE}".{TABLENAME HERE} <- This should auto-populate WHERE datetime > date_format(date_add('day', - 1, CURRENT_DATE), '%Y/%m/%d') AND eventname = 'AssumeRole' AND useragent = 'access.managedservices.amazonaws.com' -- AND json_extract_scalar(responseelements, '$.assumedRoleUser.assumedRoleId') = '<IAM PrincipalId>' ORDER BY eventtime InsightsQueryString: |- # The query provides list of AMS access sessions during specific time range. # The query accepts IAM Principal Id as an optional filter and returns event time, business need for accessing the account, requester, ... etc. # # By default; the IAM Principal ID filter is disabled (it shows access sessions for all IAM principals). # If you want to only show access sessions for a particular IAM principal ID, remove the # (#) from # the "IAM Principal ID" filter of the query, and replace the placeholder "<IAM PrincipalId>" with the specific ID that you want. # You can run the query without the filter to determine the exact IAM PrincipalId you want to filter with. # # By default; the query only shows AMS access sessions. If you also want to show non-AMS access sessions, # remove the "useragent" filter from the query. # # For expected inputs and scenarios, refer to AMS Documentation -> Tracking changes in your AMS Accelerate accounts -> Default Queries filter eventName="AssumeRole" AND userAgent="access.managedservices.amazonaws.com" # | filter responseElements.assumedRoleUser.assumedRoleId= "<IAM PrincipalId>" | sort eventTime desc | fields responseElements.assumedRoleUser.assumedRoleId as IAMPrincipalId, responseElements.credentials.accessKeyId as IAMSessionId, eventTime as EventTime, eventName as EventName, awsRegion as EventRegion, eventID as EventId, requestParameters.tags.0.value as BusinessNeed, requestParameters.tags.1.value as BusinessNeedType, requestParameters.tags.2.value as Requester, requestParameters.tags.3.value as AccessRequestType
ams_events_query_v1.yaml /* The query provides list of events to track write actions for all AMS changes. The query returns all write actions done on the account using that AMS role filter. By default, the query filters the last day's events only; you can change the "datetime" filter to search for a wider time range. You can also track mutating actions done by non-AMS roles by removing the "useridentity.arn" filter lines from the WHERE clause of the query. For expected inputs and scenarios, refer to AMS Documentation -> Tracking changes in your AMS Accelerate accounts -> Default Queries */ SELECT useridentity.principalId AS "IAM PrincipalId", useridentity.accesskeyid AS "IAM SessionId", useridentity.accountid AS "AccountId", useridentity.arn AS "RoleArn", eventid AS "EventId", eventname AS "EventName", awsregion AS "EventRegion", eventsource AS "EventService", eventtime AS "EventTime", requestparameters As "RequestParameters", responseelements AS "ResponseElements", useragent AS "UserAgent" FROM "{DATABASE NAME HERE}".{TABLENAME HERE} <- This should auto-populate WHERE readonly <> 'true' AND ( LOWER(useridentity.arn) LIKE '%/ams%' OR LOWER(useridentity.arn) LIKE '%/customer_ssm_automation_role%' ) ORDER BY eventtime
ams_instance_access_sessions_query_v1 /* The query provides list of AMS Instance accesses during specific time range. The query returns the list of AMS instance accesses; every record includes the event time, the event AWS Region, the instance ID, the IAM session ID, and the SSM session ID. You can use the IAM Principal ID to get more details on the business need for accessing the instance by using ams_access_session_query_v1 athena query. You can use the SSM session ID to get more details on the instance access session, including the start and end time of the session and log details, using the AWS Session Manager Console in the instance's AWS Region. You can also list non-AMS instance accesses by removing the "useridentity" filter line in the WHERE clause of the query. By default, the query filters the last day's events only; you can change the "datetime" filter to search for a wider time range. For expected inputs and scenarios, refer to AMS Documentation -> Tracking changes in your AMS Accelerate accounts -> Default Queries */ SELECT useridentity.principalId AS "IAM PrincipalId", useridentity.accesskeyid AS "IAM SessionId", json_extract_scalar(requestparameters, '$.target') AS "InstanceId", json_extract_scalar(responseelements, '$.sessionId') AS "SSM SessionId", eventname AS "EventName", awsregion AS "EventRegion", eventid AS "EventId", eventsource AS "EventService", eventtime AS "EventTime" FROM "{DATABASE NAME HERE}".{TABLENAME HERE} <- This should auto-populate WHERE useridentity.sessionContext.sessionIssuer.arn like '%/ams_%' AND eventname = 'StartSession' ORDER BY eventtime
ams_privilege_escalation_events_query_v1.yaml /* The query provides list of events that can directly or potentially lead to a privilege escalation. The query accepts ActionedBy as an optional filter and returns EventName, EventId, EventTime, ... etc. All fields associated with the event are also returned. Some fields are blank if not applicable for that event. You can use the IAM Session ID to get more details about events happened in that session by using ams_session_events_query_v1 query. By default, the query filters the last day's events only; you can change the "datetime" filter to search for a wider time range. By default, the ActionedBy filter is disabled (it shows privilege escalation events from all users). To show events for a particular user or role, remove the double-dash (--) from the useridentity filter line in the WHERE clause of the query and replace the placeholder "<ACTIONEDBY_PUT_USER_NAME_HERE>" with an IAM user or role name. You can run the query without the filter to determine the exact user you want to filter with. For expected inputs and scenarios, refer to AMS Documentation -> Tracking changes in your AMS Accelerate accounts -> Default Queries */ SELECT useridentity.principalId AS "IAM PrincipalId", useridentity.accesskeyid AS "IAM SessionId", useridentity.accountid AS "AccountId", reverse(split_part(reverse(useridentity.arn), ':', 1)) AS "ActionedBy", eventname AS "EventName", awsregion AS "EventRegion", eventid AS "EventId", eventtime AS "EventTime", json_extract_scalar(requestparameters, '$.userName') AS "UserName", json_extract_scalar(requestparameters, '$.roleName') AS "RoleName", json_extract_scalar(requestparameters, '$.groupName') AS "GroupName", json_extract_scalar(requestparameters, '$.policyArn') AS "PolicyArn", json_extract_scalar(requestparameters, '$.policyName') AS "PolicyName", json_extract_scalar(requestparameters, '$.permissionsBoundary') AS "PermissionsBoundary", json_extract_scalar(requestparameters, '$.instanceProfileName') AS "InstanceProfileName", json_extract_scalar(requestparameters, '$.openIDConnectProviderArn') AS "OpenIDConnectProviderArn", json_extract_scalar(requestparameters, '$.serialNumber') AS "SerialNumber", json_extract_scalar(requestparameters, '$.serverCertificateName') AS "ServerCertificateName", json_extract_scalar(requestparameters, '$.accessKeyId') AS "AccessKeyId", json_extract_scalar(requestparameters, '$.certificateId') AS "CertificateId", json_extract_scalar(requestparameters, '$.newUserName') AS "NewUserName", json_extract_scalar(requestparameters, '$.newGroupName') AS "NewGroupName", json_extract_scalar(requestparameters, '$.newServerCertificateName') AS "NewServerCertificateName", json_extract_scalar(requestparameters, '$.name') AS "SAMLProviderName", json_extract_scalar(requestparameters, '$.sAMLProviderArn') AS "SAMLProviderArn", json_extract_scalar(requestparameters, '$.sSHPublicKeyId') AS "SSHPublicKeyId", json_extract_scalar(requestparameters, '$.virtualMFADeviceName') AS "VirtualMFADeviceName" FROM "{DATABASE NAME HERE}".{TABLENAME HERE} <- This should auto-populate WHERE ( -- More event names can be found at https://docs.aws.amazon.com/IAM/latest/UserGuide/list_identityandaccessmanagement.html eventname LIKE 'Add%' OR eventname LIKE 'Attach%' OR eventname LIKE 'Delete%' AND eventname != 'DeleteAccountAlias' OR eventname LIKE 'Detach%' OR eventname LIKE 'Create%' AND eventname != 'CreateAccountAlias' OR eventname LIKE 'Put%' OR eventname LIKE 'Remove%' OR eventname LIKE 'Update%' OR eventname LIKE 'Upload%' OR eventname = 'DeactivateMFADevice' OR eventname = 'EnableMFADevice' OR eventname = 'ResetServiceSpecificCredential' OR eventname = 'SetDefaultPolicyVersion' ) AND eventsource = 'iam.amazonaws.com' ORDER BY eventtime
Name: ams_resource_events_query_v1 Description: >- The query provides list of events done on specific resource. The query accepts resource id as part of the filters, and return all write actions done on that resource. By default; the query list the accesses for last day, the user can change the time range by changing the datetime filter. AthenaQueryString: |- /* The query provides list of events done on specific resource. The query accepts the resource ID as part of the filters (replace the placeholder "<RESOURCE_INFO>" in the WHERE clause of the query), and returns all write actions done on that resource. The resource ID can be an ID for any AWS resource in the account. Example: An instance ID for an EC2 instance, table name for a DynamoDB table, logGroupName for a CloudWatch Log, etc. By default, the query filters the last day's events only; you can change the "datetime" filter to search for a wider time range. For expected inputs and scenarios, refer to AMS Documentation -> Tracking changes in your AMS Accelerate accounts -> Default Queries */ SELECT useridentity.principalId AS "IAM PrincipalId", useridentity.accesskeyid AS "IAM SessionId", useridentity.accountid AS "AccountId", reverse(split_part(reverse(useridentity.arn), ':', 1)) AS "ActionedBy", eventname AS "EventName", awsregion AS "EventRegion", eventid AS "EventId", eventsource AS "EventService", eventtime AS "EventTime" FROM "{DATABASE NAME HERE}".{TABLENAME HERE} <- This should auto-populate WHERE datetime > date_format(date_add('day', - 1, CURRENT_DATE), '%Y/%m/%d') AND readonly <> 'true' AND ( requestparameters LIKE '%<RESOURCE_INFO>%' OR responseelements LIKE '%<RESOURCE_INFO>%' ) ORDER BY eventtime InsightsQueryString: |- # The query provides list of events done on specific resource. # # The query accepts the resource ID as part of the filters (replace the placeholder "<RESOURCE_INFO>" in the filter of the query), # and returns all write actions done on that resource. The resource ID can be an ID for any AWS resource in the account. # Example: An instance ID for an EC2 instance, table name for a DynamoDB table, logGroupName for a CloudWatch Log, etc. # # For expected inputs and scenarios, refer to AMS Documentation -> Tracking changes in your AMS Accelerate accounts -> Default Queries filter readOnly=0 | parse @message '"requestParameters":{*}' as RequestParameters | parse @message '"responseElements":{*}' as ResponseElements # | filter RequestParameters like "RESOURCE_INFO" or ResponseElements like "<RESOURCE_INFO>" | fields userIdentity.principalId as IAMPrincipalId, userIdentity.accessKeyId as IAMSessionId, userIdentity.accountId as AccountId, userIdentity.arn as ActionedBy, eventName as EventName, awsRegion as EventRegion, eventID as EventId, eventSource as EventService, eventTime as EventTime | display IAMPrincipalId, IAMSessionId, AccountId, ActionedBy, EventName, EventRegion, EventId, EventService, EventTime | sort eventTime desc
Name: ams_session_events_query_v1 Description: >- The query provides list of events done on specific session. The query accepts IAM Principal Id as part of the filters, and return all write actions done on that resource. By default; the query list the accesses for last day, the user can change the time range by changing the datetime filter. AthenaQueryString: |- /* The query provides a list of events executed on a specific session. The query accepts the IAM principal ID as part of the filters (replace the placeholder "<PRINCIPAL_ID>" in the WHERE clause of the query), and returns all write actions done on that resource. By default, the query filters the last day's events only; you can change the "datetime" filter to search for a wider time range. For expected inputs and scenarios, refer to AMS Documentation -> Tracking changes in your AMS Accelerate accounts -> Default Queries */ SELECT useridentity.principalId AS "IAM PrincipalId", useridentity.accesskeyid AS "IAM SessionId", useridentity.accountid AS "AccountId", reverse(split_part(reverse(useridentity.arn), ':', 1)) AS "ActionedBy", eventname AS "EventName", awsregion AS "EventRegion", eventsource AS "EventService", eventtime AS "EventTime", requestparameters As "RequestParameters", responseelements AS "ResponseElements", useragent AS "UserAgent" FROM "{DATABASE NAME HERE}".{TABLENAME HERE} <- This should auto-populate WHERE useridentity.principalid = '<PRINCIPAL_ID>' AND datetime > date_format(date_add('day', - 1, CURRENT_DATE), '%Y/%m/%d') AND readonly <> 'true' ORDER BY eventtime InsightsQueryString: |- # The query provides a list of events executed on a specific session. # # The query accepts the IAM principal ID as part of the filters (replace the placeholder "<PRINCIPAL_ID>" in the filter of the query), # and returns all write actions done on that resource. # # For expected inputs and scenarios, refer to AMS Documentation -> Tracking changes in your AMS Accelerate accounts -> Default Queries filter readOnly=0 AND userIdentity.principalId = "<IAM Principal>" | sort eventTime desc | fields userIdentity.accessKeyId as IAMSessionId, userIdentity.principalId as IAMPrincipalId, userIdentity.accountId as AccountId, userIdentity.arn as ActionedBy, eventName as EventName, awsRegion as EventRegion, eventSource as EventService, eventTime as EventTime, userAgent as UserAgent | parse @message '"requestParameters":{*}' as RequestParameters | parse @message '"responseElements":{*}' as ResponseElements
Name: ams_session_ids_by_requester_v1 Description: >- The query provides list of IAM Principal/Session Ids for specific requester. The query accepts requester and return all IAM Principal/Session Ids by that requester during specific time range. By default; the query list the accesses for last day, the user can change the time range by changing the datetime filter. AthenaQueryString: |- /* The query provides list of IAM Principal IDs for a specific requester. The query accepts the requester (replace placeholder "<Requester>" in the WHERE clause of the query), and returns all IAM Principal IDs by that requester during a specific time range. By default, the query filters the last day's events only; you can change the "datetime" filter to search for a wider time range. For expected inputs and scenarios, refer to AMS Documentation -> Tracking changes in your AMS Accelerate accounts -> Default Queries */ SELECT json_extract_scalar(responseelements, '$.assumedRoleUser.assumedRoleId') AS "IAM PrincipalId", json_extract_scalar(responseelements, '$.credentials.accessKeyId') AS "IAM SessionIId", eventtime AS "EventTime" FROM "{DATABASE NAME HERE}".{TABLENAME HERE} <- This should auto-populate WHERE datetime > date_format(date_add('day', - 1, CURRENT_DATE), '%Y/%m/%d') AND json_extract_scalar(requestparameters, '$.tags[2].value') = '<Requester>' ORDER BY eventtime InsightsQueryString: |- # The query provides list of IAM Principal IDs for a specific requester. # # The query accepts the requester (replace placeholder "<Requester>" in the filter of the query), # and returns all IAM Principal IDs by that requester during a specific time range. # # For expected inputs and scenarios, refer to AMS Documentation -> Tracking changes in your AMS Accelerate accounts -> Default Queries filter eventName="AssumeRole" AND requestParameters.tags.2.value="<Requester>" | sort eventTime desc | fields responseElements.assumedRoleUser.assumedRoleId as IAMPrincipalId, responseElements.credentials.accessKeyId as IAMSessionId, eventTime as EventTime

레코드 권한 변경

변경 레코드 쿼리를 실행하려면 다음 권한이 필요합니다.

  • 아테나

    • athena:GetWorkGroup

    • athena:StartQueryExecution

    • athena:ListDataCatalogs

    • athena:GetQueryExecution

    • athena:GetQueryResults

    • athena:BatchGetNamedQuery

    • athena:ListWorkGroups

    • athena:UpdateWorkGroup

    • athena:GetNamedQuery

    • athena:ListQueryExecutions

    • athena:ListNamedQueries

  • AWS KMS

    • kms:Decrypt

    • AWS KMS Accelerate가 SSE-KMS 암호화를 사용하여 CloudTrail 추적 이벤트 Amazon S3 버킷 데이터 스토어를 사용하는 경우 AMSCloudTrailLogManagement의 키 ID 또는 AWS KMS 키 ID(들). Amazon S3

  • AWS Glue

    • glue:GetDatabase

    • glue:GetTables

    • glue:GetDatabases

    • glue:GetTable

  • Amazon S3 읽기 액세스

    • Amazon S3 버킷 CloudTrail 데이터 스토어: ams-aAccountId-cloudtrail-primary region 또는 Amazon S3 버킷 이름, CloudTrail 추적 이벤트 Amazon S3 버킷 데이터 스토어.

  • Amazon S3 쓰기 액세스

    • Athena 이벤트 쿼리 결과 Amazon S3 버킷: ams-aAccountId athena-results-primary region