를 사용한 조직 예제 AWS CLI - AWS SDK 코드 예제

Doc AWS SDK 예제 GitHub 리포지토리에서 더 많은 SDK 예제를 사용할 수 있습니다. AWS

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

를 사용한 조직 예제 AWS CLI

다음 코드 예제에서는 Organizations와 AWS Command Line Interface 함께를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여줍니다.

작업은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 관련 시나리오의 컨텍스트에 따라 표시되며, 개별 서비스 함수를 직접적으로 호출하는 방법을 보여줍니다.

각 예시에는 전체 소스 코드에 대한 링크가 포함되어 있으며, 여기에서 컨텍스트에 맞춰 코드를 설정하고 실행하는 방법에 대한 지침을 찾을 수 있습니다.

주제

작업

다음 코드 예시에서는 accept-handshake 코드를 사용하는 방법을 보여줍니다.

AWS CLI

다른 계정에서 핸드셰이크를 수락하는 방법

조직의 소유자인 Bill은 이전에 Juan의 계정을 초대하여 조직에 가입했습니다. 다음 예시에서는 악수를 수락하여 초대에 동의하는 Juan의 계정을 보여줍니다.

aws organizations accept-handshake --handshake-id h-examplehandshakeid111

출력은 다음과 같이 표시됩니다.

{ "Handshake": { "Action": "INVITE", "Arn": "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", "RequestedTimestamp": 1481656459.257, "ExpirationTimestamp": 1482952459.257, "Id": "h-examplehandshakeid111", "Parties": [ { "Id": "o-exampleorgid", "Type": "ORGANIZATION" }, { "Id": "juan@example.com", "Type": "EMAIL" } ], "Resources": [ { "Resources": [ { "Type": "MASTER_EMAIL", "Value": "bill@amazon.com" }, { "Type": "MASTER_NAME", "Value": "Org Master Account" }, { "Type": "ORGANIZATION_FEATURE_SET", "Value": "ALL" } ], "Type": "ORGANIZATION", "Value": "o-exampleorgid" }, { "Type": "EMAIL", "Value": "juan@example.com" } ], "State": "ACCEPTED" } }
  • API 세부 정보는 AWS CLI 명령 참조AcceptHandshake 섹션을 참조하세요.

다음 코드 예시에서는 attach-policy 코드를 사용하는 방법을 보여줍니다.

AWS CLI

정책을 루트, OU 또는 계정에 연결

예시 1

다음 예시에서는 서비스 제어 정책(SCP)을 OU에 연결하는 방법을 보여줍니다.

aws organizations attach-policy --policy-id p-examplepolicyid111 --target-id ou-examplerootid111-exampleouid111

예시 2

다음 예시에서는 계정에 서비스 제어 정책을 직접 연결하는 방법을 보여줍니다.

aws organizations attach-policy --policy-id p-examplepolicyid111 --target-id 333333333333
  • API 세부 정보는 AWS CLI 명령 참조AttachPolicy를 참조하세요.

다음 코드 예시에서는 cancel-handshake 코드를 사용하는 방법을 보여줍니다.

AWS CLI

다른 계정에서 전송된 핸드셰이크를 취소하는 방법

Bill은 이전에 자신의 조직에 가입하도록 Susan의 계정에 초대장을 보냈습니다. 마음이 바뀌어 Susan이 초대를 수락하기 전에 초대를 취소하기로 결정합니다. 다음 예시에서는 Bill의 취소를 보여줍니다.

aws organizations cancel-handshake --handshake-id h-examplehandshakeid111

출력에는 현재 CANCELED 상태임을 보여주는 핸드셰이크 객체가 포함됩니다.

{ "Handshake": { "Id": "h-examplehandshakeid111", "State":"CANCELED", "Action": "INVITE", "Arn": "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", "Parties": [ { "Id": "o-exampleorgid", "Type": "ORGANIZATION" }, { "Id": "susan@example.com", "Type": "EMAIL" } ], "Resources": [ { "Type": "ORGANIZATION", "Value": "o-exampleorgid", "Resources": [ { "Type": "MASTER_EMAIL", "Value": "bill@example.com" }, { "Type": "MASTER_NAME", "Value": "Master Account" }, { "Type": "ORGANIZATION_FEATURE_SET", "Value": "CONSOLIDATED_BILLING" } ] }, { "Type": "EMAIL", "Value": "anika@example.com" }, { "Type": "NOTES", "Value": "This is a request for Susan's account to join Bob's organization." } ], "RequestedTimestamp": 1.47008383521E9, "ExpirationTimestamp": 1.47137983521E9 } }
  • API 세부 정보는 AWS CLI 명령 참조CancelHandshake 섹션을 참조하세요.

다음 코드 예시에서는 create-account 코드를 사용하는 방법을 보여줍니다.

AWS CLI

자동으로 조직에 가입되는 멤버 계정 생성

다음 예시에서는 조직 내에 멤버 계정을 생성하는 방법을 보여줍니다. 멤버 계정은 Production Account라는 이름과 susan@example.com이라는 이메일 주소로 구성됩니다. roleName 파라미터가 지정되지 않았으므로 Organizations는 OrganizationAccountAccessRole의 기본 이름을 사용하여 IAM 역할을 자동으로 생성합니다. 또한 IamUserAccessToBilling 파라미터가 지정되지 않았으므로 IAM 사용자 또는 역할에 계정 결제 데이터에 액세스할 수 있는 충분한 권한을 허용하는 설정은 기본값인 ALLOW로 설정됩니다. 조직은 Susan에게 '환영합니다 AWS'라는 이메일을 자동으로 보냅니다.

aws organizations create-account --email susan@example.com --account-name "Production Account"

출력에는 현재 IN_PROGRESS 상태임을 보여주는 요청 객체가 포함됩니다.

{ "CreateAccountStatus": { "State": "IN_PROGRESS", "Id": "car-examplecreateaccountrequestid111" } }

나중에 describe-create-account-status 명령에 대한 Id 응답 값을 create-account-request-id 파라미터의 값으로 제공하여 요청의 현재 상태를 쿼리할 수 있습니다.

자세한 내용은 AWS Organizations 사용 설명서의 조직에서 AWS 계정 생성을 참조하세요.

  • API 세부 정보는 AWS CLI 명령 참조CreateAccount를 참조하세요.

다음 코드 예시에서는 create-organization 코드를 사용하는 방법을 보여줍니다.

AWS CLI

예시 1: 새 조직 생성

Bill은 111111111111 계정의 자격 증명을 사용하여 조직을 만들려고 합니다. 다음 예시에서는 해당 계정이 새 조직의 마스터 계정이 되는 것을 보여줍니다. Bill이 기능 세트를 지정하지 않기 때문에 새 조직에서는 기본적으로 모든 기능이 활성화되고 서비스 제어 정책은 루트에서 활성화됩니다.

aws organizations create-organization

출력에는 새 조직의 세부 정보가 있는 조직 객체가 포함됩니다.

{ "Organization": { "AvailablePolicyTypes": [ { "Status": "ENABLED", "Type": "SERVICE_CONTROL_POLICY" } ], "MasterAccountId": "111111111111", "MasterAccountArn": "arn:aws:organizations::111111111111:account/o-exampleorgid/111111111111", "MasterAccountEmail": "bill@example.com", "FeatureSet": "ALL", "Id": "o-exampleorgid", "Arn": "arn:aws:organizations::111111111111:organization/o-exampleorgid" } }

예 2: 통합 결제 기능만 활성화된 새 조직 생성

다음 예시에서는 통합 결제 기능만 지원하는 조직을 만듭니다.

aws organizations create-organization --feature-set CONSOLIDATED_BILLING

출력에는 새 조직의 세부 정보가 있는 조직 객체가 포함됩니다.

{ "Organization": { "Arn": "arn:aws:organizations::111111111111:organization/o-exampleorgid", "AvailablePolicyTypes": [], "Id": "o-exampleorgid", "MasterAccountArn": "arn:aws:organizations::111111111111:account/o-exampleorgid/111111111111", "MasterAccountEmail": "bill@example.com", "MasterAccountId": "111111111111", "FeatureSet": "CONSOLIDATED_BILLING" } }

자세한 내용은 AWS Organizations 사용자 안내서의 조직 생성을 참조하세요.

다음 코드 예시에서는 create-organizational-unit 코드를 사용하는 방법을 보여줍니다.

AWS CLI

루트 또는 상위 OU에 OU 생성

다음 예시에서는 AccountingOU라는 OU를 생성하는 방법을 보여줍니다.

aws organizations create-organizational-unit --parent-id r-examplerootid111 --name AccountingOU

출력에는 새 OU의 세부 정보가 있는 organizationalUnit 객체가 포함됩니다.

{ "OrganizationalUnit": { "Id": "ou-examplerootid111-exampleouid111", "Arn": "arn:aws:organizations::111111111111:ou/o-exampleorgid/ou-examplerootid111-exampleouid111", "Name": "AccountingOU" } }

다음 코드 예시에서는 create-policy 코드를 사용하는 방법을 보여줍니다.

AWS CLI

예시 1: JSON 정책의 텍스트 소스 파일을 사용하여 정책 생성

다음 예시에서는 이름이 AllowAllS3Actions인 서비스 제어 정책(SCP)을 생성하는 방법을 보여줍니다. 정책 콘텐츠는 policy.json이라는 로컬 컴퓨터에 있는 파일에서 가져온 것입니다.

aws organizations create-policy --content file://policy.json --name AllowAllS3Actions, --type SERVICE_CONTROL_POLICY --description "Allows delegation of all S3 actions"

출력에는 새 정책의 세부 정보가 있는 정책 객체가 포함됩니다.

{ "Policy": { "Content": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"s3:*\"],\"Resource\":[\"*\"]}]}", "PolicySummary": { "Arn": "arn:aws:organizations::o-exampleorgid:policy/service_control_policy/p-examplepolicyid111", "Description": "Allows delegation of all S3 actions", "Name": "AllowAllS3Actions", "Type":"SERVICE_CONTROL_POLICY" } } }

예시 2: JSON 정책을 파라미터로 사용하여 정책 생성

다음 예시에서는 동일한 SCP를 생성하는 방법을 보여줍니다. 이번에는 정책 콘텐츠를 파라미터에 JSON 문자열로 임베딩합니다. 파라미터에서 문자열을 큰따옴표로 묶은 리터럴로 취급하려면 큰따옴표 앞에 백슬래시를 추가하여 문자열을 이스케이프 처리해야 합니다.

aws organizations create-policy --content "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"s3:*\"],\"Resource\":[\"*\"]}]}" --name AllowAllS3Actions --type SERVICE_CONTROL_POLICY --description "Allows delegation of all S3 actions"

조직에서 정책을 만들고 사용하는 방법에 대한 자세한 내용은 AWS Organizations 사용자 안내서의 조직 정책 관리를 참조하세요.

  • API 세부 정보는 AWS CLI 명령 참조의 CreatePolicy를 참조하세요.

다음 코드 예시에서는 decline-handshake 코드를 사용하는 방법을 보여줍니다.

AWS CLI

다른 계정에서 전송된 핸드셰이크를 거부하는 방법

다음 예시에서는 계정 222222222222의 소유자인 관리자인 Susan이 Bill의 조직에 가입하라는 초대를 거부하는 것을 보여줍니다. DeclineHandshake 작업은 핸드셰이크 객체를 반환하여 상태가 이제 DECLINED임을 표시합니다.

aws organizations decline-handshake --handshake-id h-examplehandshakeid111

출력에는 DECLINED의 새 상태를 보여주는 핸드셰이크 객체가 포함됩니다.

{ "Handshake": { "Id": "h-examplehandshakeid111", "State": "DECLINED", "Resources": [ { "Type": "ORGANIZATION", "Value": "o-exampleorgid", "Resources": [ { "Type": "MASTER_EMAIL", "Value": "bill@example.com" }, { "Type": "MASTER_NAME", "Value": "Master Account" } ] }, { "Type": "EMAIL", "Value": "susan@example.com" }, { "Type": "NOTES", "Value": "This is an invitation to Susan's account to join the Bill's organization." } ], "Parties": [ { "Type": "EMAIL", "Id": "susan@example.com" }, { "Type": "ORGANIZATION", "Id": "o-exampleorgid" } ], "Action": "INVITE", "RequestedTimestamp": 1470684478.687, "ExpirationTimestamp": 1471980478.687, "Arn": "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111" } }
  • API 세부 정보는 AWS CLI 명령 참조DeclineHandshake 섹션을 참조하세요.

다음 코드 예시에서는 delete-organization 코드를 사용하는 방법을 보여줍니다.

AWS CLI

조직 삭제

다음 예시에서는 조직을 삭제하는 방법을 보여줍니다. 이 작업을 수행하려면 조직의 마스터 계정 관리자여야 합니다. 이 예시에서는 이전에 조직에서 모든 멤버 계정, OU 및 정책을 제거했다고 가정합니다.

aws organizations delete-organization

다음 코드 예시에서는 delete-organizational-unit 코드를 사용하는 방법을 보여줍니다.

AWS CLI

OU 삭제

다음 예시에서는 OU를 삭제하는 방법을 보여줍니다. 이 예시에서는 이전에 OU에서 모든 계정과 다른 OU를 제거했다고 가정합니다.

aws organizations delete-organizational-unit --organizational-unit-id ou-examplerootid111-exampleouid111

다음 코드 예시에서는 delete-policy 코드를 사용하는 방법을 보여줍니다.

AWS CLI

정책 삭제

다음 예시에서는 조직에서 정책을 삭제하는 방법을 보여줍니다. 이 예시에서는 이전에 정책을 모든 엔터티에서 분리했다고 가정합니다.

aws organizations delete-policy --policy-id p-examplepolicyid111
  • API 세부 정보는 AWS CLI 명령 참조의 DeletePolicy를 참조하세요.

다음 코드 예시에서는 describe-account 코드를 사용하는 방법을 보여줍니다.

AWS CLI

계정에 대한 세부 정보를 가져오는 방법

다음 예시에서는 계정에 대한 세부 정보를 요청하는 방법을 설명합니다.

aws organizations describe-account --account-id 555555555555

출력에는 계정에 대한 세부 정보가 포함된 계정 객체가 표시됩니다.

{ "Account": { "Id": "555555555555", "Arn": "arn:aws:organizations::111111111111:account/o-exampleorgid/555555555555", "Name": "Beta account", "Email": "anika@example.com", "JoinedMethod": "INVITED", "JoinedTimeStamp": 1481756563.134, "Status": "ACTIVE" } }
  • API 세부 정보는 AWS CLI 명령 참조DescribeAccount 섹션을 참조하세요.

다음 코드 예시에서는 describe-create-account-status 코드를 사용하는 방법을 보여줍니다.

AWS CLI

계정 생성 요청에 대한 최신 상태를 확인하는 방법

다음 예시에서는 조직에서 이전 계정 만들기 요청에 대한 최신 상태를 요청하는 방법을 보여줍니다. 지정된 --request-id는 create-account에 대한 원래 호출의 응답에서 가져옵니다. 계정 생성 요청은 상태 필드에 조직이 계정 생성을 성공적으로 완료했음을 표시합니다.

명령:

aws organizations describe-create-account-status --create-account-request-id car-examplecreateaccountrequestid111

출력:

{ "CreateAccountStatus": { "State": "SUCCEEDED", "AccountId": "555555555555", "AccountName": "Beta account", "RequestedTimestamp": 1470684478.687, "CompletedTimestamp": 1470684532.472, "Id": "car-examplecreateaccountrequestid111" } }

다음 코드 예시에서는 describe-handshake 코드를 사용하는 방법을 보여줍니다.

AWS CLI

핸드셰이크에 대한 정보 가져오기

다음 예시에서는 핸드셰이크에 대한 세부 정보를 요청하는 방법을 설명합니다. 핸드셰이크 ID는 원래 호출에서 InviteAccountToOrganization으로 연결되거나 ListHandshakesForAccount 또는 ListHandshakesForOrganization으로 연결되는 호출에서 나옵니다.

aws organizations describe-handshake --handshake-id h-examplehandshakeid111

출력에는 요청된 핸드셰이크에 대한 모든 세부 정보가 포함된 핸드셰이크 객체가 포함됩니다.

{ "Handshake": { "Id": "h-examplehandshakeid111", "State": "OPEN", "Resources": [ { "Type": "ORGANIZATION", "Value": "o-exampleorgid", "Resources": [ { "Type": "MASTER_EMAIL", "Value": "bill@example.com" }, { "Type": "MASTER_NAME", "Value": "Master Account" } ] }, { "Type": "EMAIL", "Value": "anika@example.com" } ], "Parties": [ { "Type": "ORGANIZATION", "Id": "o-exampleorgid" }, { "Type": "EMAIL", "Id": "anika@example.com" } ], "Action": "INVITE", "RequestedTimestamp": 1470158698.046, "ExpirationTimestamp": 1471454698.046, "Arn": "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111" } }
  • API 세부 정보는 AWS CLI 명령 참조DescribeHandshake 섹션을 참조하세요.

다음 코드 예시에서는 describe-organization 코드를 사용하는 방법을 보여줍니다.

AWS CLI

현재 조직에 대한 정보를 가져오는 방법

다음 예시에서는 조직의 계정 목록을 요청하는 방법을 보여줍니다.

aws organizations describe-organization

출력에는 조직에 대한 세부 정보가 있는 조직 객체가 포함됩니다.

{ "Organization": { "MasterAccountArn": "arn:aws:organizations::111111111111:account/o-exampleorgid/111111111111", "MasterAccountEmail": "bill@example.com", "MasterAccountId": "111111111111", "Id": "o-exampleorgid", "FeatureSet": "ALL", "Arn": "arn:aws:organizations::111111111111:organization/o-exampleorgid", "AvailablePolicyTypes": [ { "Status": "ENABLED", "Type": "SERVICE_CONTROL_POLICY" } ] } }

다음 코드 예시에서는 describe-organizational-unit 코드를 사용하는 방법을 보여줍니다.

AWS CLI

OU에 대한 정보 가져오기

다음 describe-organizational-unit 예시에서는 OU에 대한 세부 정보를 요청합니다.

aws organizations describe-organizational-unit \ --organizational-unit-id ou-examplerootid111-exampleouid111

출력:

{ "OrganizationalUnit": { "Name": "Accounting Group", "Arn": "arn:aws:organizations::123456789012:ou/o-exampleorgid/ou-examplerootid111-exampleouid111", "Id": "ou-examplerootid111-exampleouid111" } }

다음 코드 예시에서는 describe-policy 코드를 사용하는 방법을 보여줍니다.

AWS CLI

정책 정보 가져오기

다음 예시에서는 정책 정보를 요청하는 방법을 보여줍니다.

aws organizations describe-policy --policy-id p-examplepolicyid111

출력에는 정책의 세부 정보가 있는 정책 객체가 포함됩니다.

{ "Policy": { "Content": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Action\": \"*\",\n \"Resource\": \"*\"\n }\n ]\n}", "PolicySummary": { "Arn": "arn:aws:organizations::111111111111:policy/o-exampleorgid/service_control_policy/p-examplepolicyid111", "Type": "SERVICE_CONTROL_POLICY", "Id": "p-examplepolicyid111", "AwsManaged": false, "Name": "AllowAllS3Actions", "Description": "Enables admins to delegate S3 permissions" } } }
  • API 세부 정보는 AWS CLI 명령 참조DescribePolicy를 참조하세요.

다음 코드 예시에서는 detach-policy 코드를 사용하는 방법을 보여줍니다.

AWS CLI

정책을 루트, OU 또는 계정에서 분리

다음 예시에서는 OU에서 정책을 분리하는 방법을 보여줍니다.

aws organizations detach-policy --target-id ou-examplerootid111-exampleouid111 --policy-id p-examplepolicyid111
  • API 세부 정보는 AWS CLI 명령 참조DetachPolicy를 참조하세요.

다음 코드 예시에서는 disable-policy-type 코드를 사용하는 방법을 보여줍니다.

AWS CLI

루트에서 정책 유형을 비활성화하는 방법

다음 예시에서는 루트에서 서비스 제어 정책(SCP) 정책 유형을 비활성화하는 방법을 보여줍니다.

aws organizations disable-policy-type --root-id r-examplerootid111 --policy-type SERVICE_CONTROL_POLICY

출력에는 PolicyTypes 응답 요소에 더 이상 SERVICE_CONTROL_POLICY가 포함되어 있지 않음을 보여줍니다.

{ "Root": { "PolicyTypes": [], "Name": "Root", "Id": "r-examplerootid111", "Arn": "arn:aws:organizations::111111111111:root/o-exampleorgid/r-examplerootid111" } }
  • API 세부 정보는 AWS CLI 명령 참조DisablePolicyType 섹션을 참조하세요.

다음 코드 예시에서는 enable-all-features 코드를 사용하는 방법을 보여줍니다.

AWS CLI

조직의 모든 기능 활성화

이 예제는 조직의 초대된 모든 계정에 조직의 활성화된 모든 기능을 승인하도록 요청하는 관리자를 보여줍니다. AWS Organizations는 초대된 모든 멤버 계정에 등록된 주소로 이메일을 보내 소유자에게 전송된 핸드셰이크를 수락하여 모든 기능에 대한 변경을 승인하도록 요청합니다. 초대된 모든 멤버 계정이 핸드셰이크를 수락하면 조직 관리자는 모든 기능에 대한 변경을 완료할 수 있으며, 적절한 권한이 있는 계정은 정책을 생성하고 루트, OU 및 계정에 적용할 수 있습니다.

aws organizations enable-all-features

출력은 승인을 위해 초대된 모든 멤버 계정으로 전송되는 핸드셰이크 객체가 있습니다.

{ "Handshake": { "Action": "ENABLE_ALL_FEATURES", "Arn":"arn:aws:organizations::111111111111:handshake/o-exampleorgid/enable_all_features/h-examplehandshakeid111", "ExpirationTimestamp":1.483127868609E9, "Id":"h-examplehandshakeid111", "Parties": [ { "id":"o-exampleorgid", "type":"ORGANIZATION" } ], "requestedTimestamp":1.481831868609E9, "resources": [ { "type":"ORGANIZATION", "value":"o-exampleorgid" } ], "state":"REQUESTED" } }
  • API 세부 정보는 AWS CLI 명령 참조EnableAllFeatures 섹션을 참조하세요.

다음 코드 예시에서는 enable-policy-type 코드를 사용하는 방법을 보여줍니다.

AWS CLI

루트에서 정책 유형 사용을 활성화하는 방법

다음 예시에서는 루트에서 서비스 제어 정책(SCP) 정책 유형을 활성화하는 방법을 보여줍니다.

aws organizations enable-policy-type --root-id r-examplerootid111 --policy-type SERVICE_CONTROL_POLICY

출력에는 SCP가 이제 활성화되었음을 나타내는 policyTypes 응답 요소가 있는 루트 객체가 표시됩니다.

{ "Root": { "PolicyTypes": [ { "Status":"ENABLED", "Type":"SERVICE_CONTROL_POLICY" } ], "Id": "r-examplerootid111", "Name": "Root", "Arn": "arn:aws:organizations::111111111111:root/o-exampleorgid/r-examplerootid111" } }
  • API 세부 정보는 AWS CLI 명령 참조EnablePolicyType 섹션을 참조하세요.

다음 코드 예시에서는 invite-account-to-organization 코드를 사용하는 방법을 보여줍니다.

AWS CLI

조직에 가입하도록 계정 초대

다음 예시에서는 bill@example.com이 소유한 마스터 계정을 juan@example.com이 소유한 계정을 조직에 가입하도록 초대하는 것을 보여줍니다.

aws organizations invite-account-to-organization --target '{"Type": "EMAIL", "Id": "juan@example.com"}' --notes "This is a request for Juan's account to join Bill's organization."

출력에는 초대된 계정으로 전송된 내용을 보여주는 핸드셰이크 구조가 포함되어 있습니다.

{ "Handshake": { "Action": "INVITE", "Arn": "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", "ExpirationTimestamp": 1482952459.257, "Id": "h-examplehandshakeid111", "Parties": [ { "Id": "o-exampleorgid", "Type": "ORGANIZATION" }, { "Id": "juan@example.com", "Type": "EMAIL" } ], "RequestedTimestamp": 1481656459.257, "Resources": [ { "Resources": [ { "Type": "MASTER_EMAIL", "Value": "bill@amazon.com" }, { "Type": "MASTER_NAME", "Value": "Org Master Account" }, { "Type": "ORGANIZATION_FEATURE_SET", "Value": "FULL" } ], "Type": "ORGANIZATION", "Value": "o-exampleorgid" }, { "Type": "EMAIL", "Value": "juan@example.com" } ], "State": "OPEN" } }

다음 코드 예시에서는 leave-organization 코드를 사용하는 방법을 보여줍니다.

AWS CLI

멤버 계정으로 조직에서 나가기

다음 예시에서는 현재 멤버인 조직을 떠나도록 요청하는 멤버 계정의 관리자를 보여줍니다.

aws organizations leave-organization
  • API 세부 정보는 AWS CLI 명령 참조LeaveOrganization 섹션을 참조하세요.

다음 코드 예시에서는 list-accounts-for-parent 코드를 사용하는 방법을 보여줍니다.

AWS CLI

지정된 상위 루트 또는 OU의 모든 계정 목록을 검색하는 방법

다음 예시에서는 OU의 계정 목록을 요청하는 방법을 보여줍니다.

aws organizations list-accounts-for-parent --parent-id ou-examplerootid111-exampleouid111

출력에는 계정 요약 객체 목록이 포함됩니다.

{ "Accounts": [ { "Arn": "arn:aws:organizations::111111111111:account/o-exampleorgid/333333333333", "JoinedMethod": "INVITED", "JoinedTimestamp": 1481835795.536, "Id": "333333333333", "Name": "Development Account", "Email": "juan@example.com", "Status": "ACTIVE" }, { "Arn": "arn:aws:organizations::111111111111:account/o-exampleorgid/444444444444", "JoinedMethod": "INVITED", "JoinedTimestamp": 1481835812.143, "Id": "444444444444", "Name": "Test Account", "Email": "anika@example.com", "Status": "ACTIVE" } ] }

다음 코드 예시에서는 list-accounts 코드를 사용하는 방법을 보여줍니다.

AWS CLI

조직의 모든 계정 목록 가져오기

다음 예시에서는 조직의 계정 목록을 요청하는 방법을 보여줍니다.

aws organizations list-accounts

출력에는 계정 요약 객체 목록이 포함됩니다.

{ "Accounts": [ { "Arn": "arn:aws:organizations::111111111111:account/o-exampleorgid/111111111111", "JoinedMethod": "INVITED", "JoinedTimestamp": 1481830215.45, "Id": "111111111111", "Name": "Master Account", "Email": "bill@example.com", "Status": "ACTIVE" }, { "Arn": "arn:aws:organizations::111111111111:account/o-exampleorgid/222222222222", "JoinedMethod": "INVITED", "JoinedTimestamp": 1481835741.044, "Id": "222222222222", "Name": "Production Account", "Email": "alice@example.com", "Status": "ACTIVE" }, { "Arn": "arn:aws:organizations::111111111111:account/o-exampleorgid/333333333333", "JoinedMethod": "INVITED", "JoinedTimestamp": 1481835795.536, "Id": "333333333333", "Name": "Development Account", "Email": "juan@example.com", "Status": "ACTIVE" }, { "Arn": "arn:aws:organizations::111111111111:account/o-exampleorgid/444444444444", "JoinedMethod": "INVITED", "JoinedTimestamp": 1481835812.143, "Id": "444444444444", "Name": "Test Account", "Email": "anika@example.com", "Status": "ACTIVE" } ] }
  • API 세부 정보는 AWS CLI 명령 참조ListAccounts를 참조하세요.

다음 코드 예시에서는 list-children 코드를 사용하는 방법을 보여줍니다.

AWS CLI

상위 OUs 또는 루트의 하위 계정 및 OU를 검색하는 방법

다음 예시에서는 해당 계정 444444444444이 포함된 루트 또는 OU를 나열하는 방법을 보여줍니다.

aws organizations list-children --child-type ORGANIZATIONAL_UNIT --parent-id ou-examplerootid111-exampleouid111

출력에는 부모에 포함된 두 개의 자식 OU가 표시됩니다.

{ "Children": [ { "Id": "ou-examplerootid111-exampleouid111", "Type":"ORGANIZATIONAL_UNIT" }, { "Id":"ou-examplerootid111-exampleouid222", "Type":"ORGANIZATIONAL_UNIT" } ] }
  • API 세부 정보는 AWS CLI 명령 참조ListChildren 섹션을 참조하세요.

다음 코드 예시에서는 list-create-account-status 코드를 사용하는 방법을 보여줍니다.

AWS CLI

예시 1: 현재 조직에서 수행된 계정 생성 요청 목록을 검색하는 방법

다음 예시에서는 성공적으로 완료된 조직에 대한 계정 생성 요청 목록을 요청하는 방법을 보여줍니다.

aws organizations list-create-account-status --states SUCCEEDED

출력에는 각 요청에 대한 정보가 포함된 객체 배열이 포함됩니다.

{ "CreateAccountStatuses": [ { "AccountId": "444444444444", "AccountName": "Developer Test Account", "CompletedTimeStamp": 1481835812.143, "Id": "car-examplecreateaccountrequestid111", "RequestedTimeStamp": 1481829432.531, "State": "SUCCEEDED" } ] }

예시 2: 현재 조직에서 진행 중인 계정 생성 요청 목록을 검색하는 방법

다음 예시에서는 조직에 대해 진행 중인 계정 생성 요청 목록을 가져옵니다.

aws organizations list-create-account-status --states IN_PROGRESS

출력에는 각 요청에 대한 정보가 포함된 객체 배열이 포함됩니다.

{ "CreateAccountStatuses": [ { "State": "IN_PROGRESS", "Id": "car-examplecreateaccountrequestid111", "RequestedTimeStamp": 1481829432.531, "AccountName": "Production Account" } ] }

다음 코드 예시에서는 list-handshakes-for-account 코드를 사용하는 방법을 보여줍니다.

AWS CLI

계정으로 전송된 핸드셰이크 목록을 검색하는 방법

다음 예시에서는 작업을 호출하는 데 사용된 자격 증명의 계정과 연결된 모든 핸드셰이크 목록을 가져오는 방법을 보여줍니다.

aws organizations list-handshakes-for-account

출력에는 현재 상태를 포함한 각 핸드셰이크에 대한 정보와 함께 핸드셰이크 구조 목록이 포함됩니다.

{ "Handshake": { "Action": "INVITE", "Arn": "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", "ExpirationTimestamp": 1482952459.257, "Id": "h-examplehandshakeid111", "Parties": [ { "Id": "o-exampleorgid", "Type": "ORGANIZATION" }, { "Id": "juan@example.com", "Type": "EMAIL" } ], "RequestedTimestamp": 1481656459.257, "Resources": [ { "Resources": [ { "Type": "MASTER_EMAIL", "Value": "bill@amazon.com" }, { "Type": "MASTER_NAME", "Value": "Org Master Account" }, { "Type": "ORGANIZATION_FEATURE_SET", "Value": "FULL" } ], "Type": "ORGANIZATION", "Value": "o-exampleorgid" }, { "Type": "EMAIL", "Value": "juan@example.com" } ], "State": "OPEN" } }

다음 코드 예시에서는 list-handshakes-for-organization 코드를 사용하는 방법을 보여줍니다.

AWS CLI

조직과 연결된 핸드셰이크 목록을 검색하는 방법

다음 예시에서는 현재 조직과 연결된 핸드셰이크 목록을 가져오는 방법을 보여줍니다.

aws organizations list-handshakes-for-organization

출력에는 두 개의 핸드셰이크가 표시됩니다. 첫 번째는 Juan의 계정에 대한 초대이며 OPEN 상태를 보여줍니다. 두 번째는 Anika의 계정에 대한 초대이며 수락됨 상태를 보여줍니다.

{ "Handshakes": [ { "Action": "INVITE", "Arn": "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", "ExpirationTimestamp": 1482952459.257, "Id": "h-examplehandshakeid111", "Parties": [ { "Id": "o-exampleorgid", "Type": "ORGANIZATION" }, { "Id": "juan@example.com", "Type": "EMAIL" } ], "RequestedTimestamp": 1481656459.257, "Resources": [ { "Resources": [ { "Type": "MASTER_EMAIL", "Value": "bill@amazon.com" }, { "Type": "MASTER_NAME", "Value": "Org Master Account" }, { "Type": "ORGANIZATION_FEATURE_SET", "Value": "FULL" } ], "Type": "ORGANIZATION", "Value": "o-exampleorgid" }, { "Type": "EMAIL", "Value": "juan@example.com" }, { "Type":"NOTES", "Value":"This is an invitation to Juan's account to join Bill's organization." } ], "State": "OPEN" }, { "Action": "INVITE", "State":"ACCEPTED", "Arn": "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", "ExpirationTimestamp": 1.471797437427E9, "Id": "h-examplehandshakeid222", "Parties": [ { "Id": "o-exampleorgid", "Type": "ORGANIZATION" }, { "Id": "anika@example.com", "Type": "EMAIL" } ], "RequestedTimestamp": 1.469205437427E9, "Resources": [ { "Resources": [ { "Type":"MASTER_EMAIL", "Value":"bill@example.com" }, { "Type":"MASTER_NAME", "Value":"Master Account" } ], "Type":"ORGANIZATION", "Value":"o-exampleorgid" }, { "Type":"EMAIL", "Value":"anika@example.com" }, { "Type":"NOTES", "Value":"This is an invitation to Anika's account to join Bill's organization." } ] } ] }

다음 코드 예시에서는 list-organizational-units-for-parent 코드를 사용하는 방법을 보여줍니다.

AWS CLI

상위 OUs 또는 루트에서 OU 목록을 검색하는 방법

다음 예시에서는 지정된 루트에서 OU 목록을 가져오는 방법을 보여줍니다.

aws organizations list-organizational-units-for-parent --parent-id r-examplerootid111

출력은 지정된 루트에 두 개의 OU가 포함되어 있음과 각각의 세부 정보를 보여줍니다.

{ "OrganizationalUnits": [ { "Name": "AccountingDepartment", "Arn": "arn:aws:organizations::o-exampleorgid:ou/r-examplerootid111/ou-examplerootid111-exampleouid111" }, { "Name": "ProductionDepartment", "Arn": "arn:aws:organizations::o-exampleorgid:ou/r-examplerootid111/ou-examplerootid111-exampleouid222" } ] }

다음 코드 예시에서는 list-parents 코드를 사용하는 방법을 보여줍니다.

AWS CLI

계정 또는 하위 OUs의 상위 OU 또는 루트를 나열하는 방법

다음 예시에서는 해당 계정 444444444444이 포함된 루트 또는 상위 OU를 나열하는 방법을 보여줍니다.

aws organizations list-parents --child-id 444444444444

출력에는 지정된 계정이 지정된 ID를 가진 OU에 있음을 보여줍니다.

{ "Parents": [ { "Id": "ou-examplerootid111-exampleouid111", "Type": "ORGANIZATIONAL_UNIT" } ] }
  • API 세부 정보는 AWS CLI 명령 참조ListParents 섹션을 참조하세요.

다음 코드 예시에서는 list-policies-for-target 코드를 사용하는 방법을 보여줍니다.

AWS CLI

계정에 직접 연결된 SCPs 목록을 검색하는 방법

다음 예시에서는 필터 파라미터에 지정된 대로 계정에 직접 연결된 모든 서비스 제어 정책(SCP) 목록을 가져오는 방법을 보여줍니다.

aws organizations list-policies-for-target --filter SERVICE_CONTROL_POLICY --target-id 444444444444

출력에는 정책에 대한 요약 정보와 함께 정책 구조 목록이 포함됩니다. 목록에는 OU 계층 구조의 위치에서 상속되기 때문에 계정에 적용되는 정책이 포함되지 않습니다.

{ "Policies": [ { "Type": "SERVICE_CONTROL_POLICY", "Name": "AllowAllEC2Actions", "AwsManaged", false, "Id": "p-examplepolicyid222", "Arn": "arn:aws:organizations::o-exampleorgid:policy/service_control_policy/p-examplepolicyid222", "Description": "Enables account admins to delegate permissions for any EC2 actions to users and roles in their accounts." } ] }

다음 코드 예시에서는 list-policies 코드를 사용하는 방법을 보여줍니다.

AWS CLI

특정 유형의 조직에 있는 모든 정책 목록 가져오기

다음 예시에서는 필터 파라미터로 지정된 SCP 목록을 가져오는 방법을 보여줍니다.

aws organizations list-policies --filter SERVICE_CONTROL_POLICY

출력에는 요약 정보가 있는 정책 목록이 포함됩니다.

{ "Policies": [ { "Type": "SERVICE_CONTROL_POLICY", "Name": "AllowAllS3Actions", "AwsManaged": false, "Id": "p-examplepolicyid111", "Arn": "arn:aws:organizations::111111111111:policy/service_control_policy/p-examplepolicyid111", "Description": "Enables account admins to delegate permissions for any S3 actions to users and roles in their accounts." }, { "Type": "SERVICE_CONTROL_POLICY", "Name": "AllowAllEC2Actions", "AwsManaged": false, "Id": "p-examplepolicyid222", "Arn": "arn:aws:organizations::111111111111:policy/service_control_policy/p-examplepolicyid222", "Description": "Enables account admins to delegate permissions for any EC2 actions to users and roles in their accounts." }, { "AwsManaged": true, "Description": "Allows access to every operation", "Type": "SERVICE_CONTROL_POLICY", "Id": "p-FullAWSAccess", "Arn": "arn:aws:organizations::aws:policy/service_control_policy/p-FullAWSAccess", "Name": "FullAWSAccess" } ] }
  • API 세부 정보는 AWS CLI 명령 참조ListPolicies를 참조하세요.

다음 코드 예시에서는 list-roots 코드를 사용하는 방법을 보여줍니다.

AWS CLI

조직의 루트 목록 검색

이 예시에서는 조직의 루트 목록을 가져오는 방법을 보여줍니다.

aws organizations list-roots

출력에는 요약 정보가 포함된 루트 구조 목록이 포함됩니다.

{ "Roots": [ { "Name": "Root", "Arn": "arn:aws:organizations::111111111111:root/o-exampleorgid/r-examplerootid111", "Id": "r-examplerootid111", "PolicyTypes": [ { "Status":"ENABLED", "Type":"SERVICE_CONTROL_POLICY" } ] } ] }
  • API 세부 정보는 AWS CLI 명령 참조ListRoots 섹션을 참조하세요.

다음 코드 예시에서는 list-targets-for-policy 코드를 사용하는 방법을 보여줍니다.

AWS CLI

정책이 첨부된 루트, OU 및 계정 목록 검색

다음 예시에서는 지정된 정책이 연결된 루트, OU 및 계정 목록을 가져오는 방법을 보여줍니다.

aws organizations list-targets-for-policy --policy-id p-FullAWSAccess

출력에는 정책이 첨부된 루트, OU 및 계정에 대한 요약 정보와 함께 첨부 객체 목록이 포함됩니다.

{ "Targets": [ { "Arn": "arn:aws:organizations::111111111111:root/o-exampleorgid/r-examplerootid111", "Name": "Root", "TargetId":"r-examplerootid111", "Type":"ROOT" }, { "Arn": "arn:aws:organizations::111111111111:account/o-exampleorgid/333333333333;", "Name": "Developer Test Account", "TargetId": "333333333333", "Type": "ACCOUNT" }, { "Arn":"arn:aws:organizations::111111111111:ou/o-exampleorgid/ou-examplerootid111-exampleouid111", "Name":"Accounting", "TargetId":"ou-examplerootid111-exampleouid111", "Type":"ORGANIZATIONAL_UNIT" } ] }

다음 코드 예시에서는 move-account 코드를 사용하는 방법을 보여줍니다.

AWS CLI

루트 또는 OUs 간에 계정을 이동하는 방법

다음 예시에서는 조직의 마스터 계정을 루트에서 OU로 이동하는 방법을 보여줍니다.

aws organizations move-account --account-id 333333333333 --source-parent-id r-examplerootid111 --destination-parent-id ou-examplerootid111-exampleouid111
  • API 세부 정보는 AWS CLI 명령 참조MoveAccount 섹션을 참조하세요.

다음 코드 예시에서는 remove-account-from-organization 코드를 사용하는 방법을 보여줍니다.

AWS CLI

조직에서 마스터 계정으로 계정을 제거하는 방법

다음 예시에서는 조직의 계정 목록을 요청하는 방법을 보여줍니다.

aws organizations remove-account-from-organization --account-id 333333333333

다음 코드 예시에서는 update-organizational-unit 코드를 사용하는 방법을 보여줍니다.

AWS CLI

OU의 이름 바꾸기

이 예시에서는 OU의 이름을 바꾸는 방법을 보여줍니다. 이 예시에서는 OU의 이름이 'AccountingOU'로 변경됩니다.

aws organizations update-organizational-unit --organizational-unit-id ou-examplerootid111-exampleouid111 --name AccountingOU

출력에는 새 이름이 표시됩니다.

{ "OrganizationalUnit": { "Id": "ou-examplerootid111-exampleouid111" "Name": "AccountingOU", "Arn": "arn:aws:organizations::111111111111:ou/o-exampleorgid/ou-examplerootid111-exampleouid111"" } }

다음 코드 예시에서는 update-policy 코드를 사용하는 방법을 보여줍니다.

AWS CLI

예시 1: 정책 이름 바꾸기

다음 update-policy 예시에서는 정책의 이름을 바꾸고 새 설명을 제공합니다.

aws organizations update-policy \ --policy-id p-examplepolicyid111 \ --name Renamed-Policy \ --description "This description replaces the original."

출력에는 새 이름과 설명이 표시됩니다.

{ "Policy": { "Content": "{\n \"Version\":\"2012-10-17\",\n \"Statement\":{\n \"Effect\":\"Allow\",\n \"Action\":\"ec2:*\",\n \"Resource\":\"*\"\n }\n}\n", "PolicySummary": { "Id": "p-examplepolicyid111", "AwsManaged": false, "Arn":"arn:aws:organizations::111111111111:policy/o-exampleorgid/service_control_policy/p-examplepolicyid111", "Description": "This description replaces the original.", "Name": "Renamed-Policy", "Type": "SERVICE_CONTROL_POLICY" } } }

예시 2: 정책의 JSON 텍스트 콘텐츠를 바꾸려면

다음 예시에서는 이전 예시에서 SCP의 JSON 텍스트를 EC2 대신 S3를 허용하는 새 JSON 정책 텍스트 문자열로 바꾸는 방법을 보여줍니다.

aws organizations update-policy \ --policy-id p-examplepolicyid111 \ --content "{\"Version\":\"2012-10-17\",\"Statement\":{\"Effect\":\"Allow\",\"Action\":\"s3:*\",\"Resource\":\"*\"}}"

출력에는 새 콘텐츠가 표시됩니다.

{ "Policy": { "Content": "{ \"Version\": \"2012-10-17\", \"Statement\": { \"Effect\": \"Allow\", \"Action\": \"s3:*\", \"Resource\": \"*\" } }", "PolicySummary": { "Arn": "arn:aws:organizations::111111111111:policy/o-exampleorgid/service_control_policy/p-examplepolicyid111", "AwsManaged": false; "Description": "This description replaces the original.", "Id": "p-examplepolicyid111", "Name": "Renamed-Policy", "Type": "SERVICE_CONTROL_POLICY" } } }
  • API 세부 정보는 AWS CLI 명령 참조UpdatePolicy 섹션을 참조하세요.