AWS Command Line Interface를 사용하여 집계자 설정 - AWS Config

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

AWS Command Line Interface를 사용하여 집계자 설정

AWS Command Line Interface(AWS CLI)를 사용하여 AWS Config 집계자를 데이터를 생성하고 보고 업데이트하고 삭제할 수 있습니다.

AWS CLI는 AWS 서비스를 관리하는 통합 도구입니다. 도구 하나만 다운로드하여 구성하면 여러 AWS 서비스를 명령줄에서 관리하고 스크립트를 사용하여 자동화할 수 있습니다. AWS CLI에 대한 자세한 내용 및 AWS CLI 도구 설치에 대한 지침은 AWS Command Line Interface 사용 설명서에서 다음을 참조하세요.

필요할 경우, aws configure를 입력하여 AWS CLI를 AWS Config 애그리게이터가 사용 가능한 AWS 리전을 사용하도록 구성합니다.

개별 계정을 사용하여 집계자 추가

  1. 명령 프롬프트 또는 터미널 창을 엽니다.

  2. 다음 명령을 입력하여 MyAggregator라는 애그리게이터를 생성합니다.

    aws configservice put-configuration-aggregator --configuration-aggregator-name MyAggregator --account-aggregation-sources "[{\"AccountIds\": [\"AccountID1\",\"AccountID2\",\"AccountID3\"],\"AllAwsRegions\": true}]"

    account-aggregation-sources에 대해 다음 중 하나를 입력합니다.

    • 데이터를 집계하려는 AWS 계정 ID의 목록(쉼표로 구분). 계정 ID를 대괄호로 묶고 반드시 따옴표를 이스케이프 처리해야 합니다(예: "[{\"AccountIds\": [\"AccountID1\",\"AccountID2\",\"AccountID3\"],\"AllAwsRegions\": true}]").

    • 쉼표로 구분된 AWS 계정 ID의 JSON 파일을 업로드할 수도 있습니다. 다음 구문을 사용하여 파일을 업로드합니다. --account-aggregation-sources MyFilePath/MyFile.json

      JSON 파일은 다음 형식이어야 합니다.

    [ { "AccountIds": [ "AccountID1", "AccountID2", "AccountID3" ], "AllAwsRegions": true } ]
  3. 입력을 눌러 명령을 실행합니다.

    다음과 유사한 출력 화면이 표시되어야 합니다.

    { "ConfigurationAggregator": { "ConfigurationAggregatorArn": "arn:aws:config:Region:AccountID:config-aggregator/config-aggregator-floqpus3", "CreationTime": 1517942461.442, "ConfigurationAggregatorName": "MyAggregator", "AccountAggregationSources": [ { "AllAwsRegions": true, "AccountIds": [ "AccountID1", "AccountID2", "AccountID3" ] } ], "LastUpdatedTime": 1517942461.442 } }

AWS Organizations를 사용하여 집계자 추가

이 절차를 시작하기 전에 사용자는 관리 계정 또는 등록된 위임된 관리자로 로그인되어 있어야 하고 조직에서 모든 기능이 활성화되어 있어야 합니다.

참고

위임된 관리자가 집계자를 생성하기 전에 관리 계정에서 다음 AWS Config 서비스 보안 주체 이름(config.amazonaws.comconfig-multiaccountsetup.amazonaws.com)을 모두 사용하여 위임된 관리자를 등록해야 합니다. 위임된 관리자를 등록하려면 위임된 관리자 등록 문서를 참조하세요.

  1. 명령 프롬프트 또는 터미널 창을 엽니다.

  2. AWS Config 애그리게이터의 IAM 역할을 아직 생성하지 않았다면 다음 명령을 입력합니다.

    aws iam create-role --role-name OrgConfigRole --assume-role-policy-document "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"config.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}" --description "Role for organizational AWS Config aggregator"
    참고

    이 IAM 역할의 Amazon 리소스 이름(ARN)을 복사하여 AWS Config 집계자를 생성할 때 사용합니다. 응답 객체에서 ARN을 확인할 수 있습니다.

  3. IAM 역할에 정책을 연결하지 않은 경우 AWSConfigRoleForOrganizations관리형 정책을 연결하거나 다음 명령을 입력합니다.

    aws iam create-policy --policy-name OrgConfigPolicy --policy-document "{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["organizations:ListAccounts","organizations:DescribeOrganization","organizations:ListAWSServiceAccessForOrganization","organizations:ListDelegatedAdministrators"],"Resource":"*"}]}
  4. 다음 명령을 입력하여 MyAggregator라는 애그리게이터를 생성합니다.

    aws configservice put-configuration-aggregator --configuration-aggregator-name MyAggregator --organization-aggregation-source "{\"RoleArn\": \"Complete-Arn\",\"AllAwsRegions\": true}"
  5. 입력을 눌러 명령을 실행합니다.

    다음과 유사한 출력 화면이 표시되어야 합니다.

    { "ConfigurationAggregator": { "ConfigurationAggregatorArn": "arn:aws:config:Region:AccountID:config-aggregator/config-aggregator-floqpus3", "CreationTime": 1517942461.442, "ConfigurationAggregatorName": "MyAggregator", "OrganizationAggregationSource": { "AllAwsRegions": true, "RoleArn": "arn:aws:iam::account-of-role-to-assume:role/name-of-role" }, "LastUpdatedTime": 1517942461.442 } }

위임된 관리자 등록

위임된 관리자는 지정된 AWS 서비스에 대한 추가 관리 권한이 부여된 특정 AWS Organization 내 계정입니다.

  1. 관리 계정 보안 인증 정보를 사용하여 로그인

  2. 명령 프롬프트 또는 터미널 창을 엽니다.

  3. 다음 명령을 입력하여 조직의 위임된 관리자로 서비스 액세스를 활성화하여 조직 전체에 AWS Config 규칙 및 규정 준수 팩을 배포하고 관리할 수 있도록 합니다.

    aws organizations enable-aws-service-access --service-principal=config-multiaccountsetup.amazonaws.com
  4. 다음 명령을 입력하여 조직의 위임된 관리자로 서비스 액세스를 활성화하여 조직 전체의 AWS Config 데이터를 집계할 수 있도록 합니다.

    aws organizations enable-aws-service-access --service-principal=config.amazonaws.com
  5. 서비스 액세스 활성화가 완료되었는지 확인하려면 다음 명령을 입력하고 Enter 키를 눌러 명령을 실행합니다.

    aws organizations list-aws-service-access-for-organization

    다음과 유사한 출력 화면이 표시되어야 합니다.

    { "EnabledServicePrincipals": [ { "ServicePrincipal": [ "config.amazonaws.com", "config-multiaccountsetup.amazonaws.com" ], "DateEnabled": 1607020860.881 } ] }
  6. 그런 다음, 다음 명령을 입력하여 멤버 계정을 AWS Config의 위임된 관리자로 등록합니다.

    aws organizations register-delegated-administrator --service-principal=config-multiaccountsetup.amazonaws.com --account-id MemberAccountID

    그리고

    aws organizations register-delegated-administrator --service-principal=config.amazonaws.com --account-id MemberAccountID
  7. 위임된 관리자 등록이 완료되었는지 확인하려면 관리 계정에서 다음 명령을 입력하고 Enter 키를 눌러 명령을 실행합니다.

    aws organizations list-delegated-administrators --service-principal=config-multiaccountsetup.amazonaws.com

    그리고

    aws organizations list-delegated-administrators --service-principal=config.amazonaws.com

    다음과 유사한 출력 화면이 표시되어야 합니다.

    { "DelegatedAdministrators": [ { "Id": "MemberAccountID", "Arn": "arn:aws:organizations::MemberAccountID:account/o-c7esubdi38/MemberAccountID", "Email": "name@amazon.com", "Name": "name", "Status": "ACTIVE", "JoinedMethod": "INVITED", "JoinedTimestamp": 1604867734.48, "DelegationEnabledDate": 1607020986.801 } ] }

집계자 보기

  1. 다음 명령을 입력합니다.

    aws configservice describe-configuration-aggregators
  2. 소스 계정에 따라 다음과 유사한 출력이 표시됩니다.

    개별 계정

    { "ConfigurationAggregators": [ { "ConfigurationAggregatorArn": "arn:aws:config:Region:AccountID:config-aggregator/config-aggregator-floqpus3", "CreationTime": 1517942461.442, "ConfigurationAggregatorName": "MyAggregator", "AccountAggregationSources": [ { "AllAwsRegions": true, "AccountIds": [ "AccountID1", "AccountID2", "AccountID3" ] } ], "LastUpdatedTime": 1517942461.455 } ] }

    OR

    조직

    { "ConfigurationAggregator": { "ConfigurationAggregatorArn": "arn:aws:config:Region:AccountID:config-aggregator/config-aggregator-floqpus3", "CreationTime": 1517942461.442, "ConfigurationAggregatorName": "MyAggregator", "OrganizationAggregationSource": { "AllAwsRegions": true, "RoleArn": "arn:aws:iam::account-of-role-to-assume:role/name-of-role" }, "LastUpdatedTime": 1517942461.442 } }

집계자 편집

  1. put-configuration-aggregator 명령을 사용하여 구성 집계자를 업데이트 또는 편집할 수 있습니다.

    다음 명령을 입력하여 MyAggregator에 새 계정 ID를 추가합니다.

    aws configservice put-configuration-aggregator --configuration-aggregator-name MyAggregator --account-aggregation-sources "[{\"AccountIds\": [\"AccountID1\",\"AccountID2\",\"AccountID3\"],\"AllAwsRegions\": true}]"
  2. 소스 계정에 따라 다음과 유사한 출력이 표시됩니다.

    개별 계정

    { "ConfigurationAggregator": { "ConfigurationAggregatorArn": "arn:aws:config:Region:AccountID:config-aggregator/config-aggregator-xz2upuu6", "CreationTime": 1517952090.769, "ConfigurationAggregatorName": "MyAggregator", "AccountAggregationSources": [ { "AllAwsRegions": true, "AccountIds": [ "AccountID1", "AccountID2", "AccountID3", "AccountID4" ] } ], "LastUpdatedTime": 1517952566.445 } }

    OR

    조직

    { "ConfigurationAggregator": { "ConfigurationAggregatorArn": "arn:aws:config:Region:AccountID:config-aggregator/config-aggregator-floqpus3", "CreationTime": 1517942461.442, "ConfigurationAggregatorName": "MyAggregator", "OrganizationAggregationSource": { "AllAwsRegions": true, "RoleArn": "arn:aws:iam::account-of-role-to-assume:role/name-of-role" }, "LastUpdatedTime": 1517942461.442 } }

집계자 삭제

AWS CLI를 사용하여 구성 집계자를 삭제하려면
  • 다음 명령을 입력합니다.

    aws configservice delete-configuration-aggregator --configuration-aggregator-name MyAggregator

    명령이 성공하면 추가 출력이 표시되지 않습니다.

자세히 알아보기