基准API用量示例 - AWS Control Tower

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

基准API用量示例

本节包含 Cont AWS rol Tower 基准的输入和输出参数示例APIs。

DisableBaseline

有关此API操作的更多信息,请参阅DisableBaseline

DisableBaseline输入:

{ "enabledBaselineIdentifier": "arn:aws:controltower:us-west-2:123456789012:enabledbaseline/AB12CD34EF56GH789" }

DisableBaseline输出:

{ "operationIdentifier": "58f12232-26be-4735-a3e9-dd30d90f021f" }

DisableBaselineCLI示例:

aws controltower disable-baseline \ --enabled-baseline-identifier arn:aws:controltower:us-west-2:123456789012:enabledbaseline/AB12CD34EF56GH789 \ --region us-west-2

EnableBaseline

有关此API操作的更多信息,请参阅EnableBaseline

EnableBaseline输入:

{ "baselineIdentifier": "arn:aws:controltower:us-west-2::baseline:17BSJV3IGJ2QSGA2", "targetIdentifier": "arn:aws:organizations::123456789012:ou/o-kgj0txdhpa/ou-r9mj-4j3mzjql", "baselineVersion": "3.0", "parameters": [ { "key": "IdentityCenterEnabledBaselineArn", "value": "arn:aws:controltower:us-west-2:123456789012:enabledbaseline/XAHCR4CJTSI4W07MZ" } ] }

EnableBaseline输出,返回一个新资源:

{ "operationIdentifier": "58f12232-26be-4735-a3e9-dd30d90f021f", "arn": "arn:aws:controltower:us-west-2:123456789012:enabledbaseline/XAGF7TNOHRD7ES5VV" }

EnableBaselineCLI示例:

此示例显示了为启用基准的示例 AWS Organizations 已选择加入 landing zone 的组织 AWS IAM身份中心访问权限,由 Cont AWS rol Tower 管理。要检索您的 Identity Center EnabledBaseline 标识符 ListEnabledBaselinesAPI,您可以调用,按身份中心基准进行筛选:(arn:aws:controltower:Region::baseline/LN25R72TTG6IGPTQ)

aws controltower list-enabled-baselines \ --filter baselineIdentifiers=arn:aws:controltower:us-west-2::baseline/LN25R72TTG6IGPTQ \ --region us-west-2

响应将显示EnabledBaseline详细信息,其中显示其标识符。

{ "enabledBaselines": [ { "arn": "arn:aws:controltower:us-west-2:123456789012:enabledbaseline/XAHXS7P6C4I453EZC", "baselineIdentifier": "arn:aws:controltower:us-west-2::baseline/LN25R72TTG6IGPTQ", "targetIdentifier": "arn:aws:organizations::123456789012:account/o-aq21sw43de5/123456789012", "statusSummary": { "status": "SUCCEEDED" } } ] }
注意

记下响应中的ARN值,并将此值作为参数传递以启用默认基准。

aws controltower enable-baseline \ --baseline-identifier arn:aws:controltower:us-west-2::baseline/17BSJV3IGJ2QSGA2 \ --baseline-version 3.0 \ --target-identifier arn:aws:organizations::123456789012:ou/o-aq21sw43de5/ou-po90-lk87jh65 \ --parameters '[{"key":"IdentityCenterEnabledBaselineArn","value":"arn:aws:controltower:us-west-2:123456789012:enabledbaseline/XAHXS7P6C4I453EZC"}]' \ --region us-west-2

对于选择退出 Ident IAM ity Center 的 Cont AWS rol Tower 管理的组织,请启用不带参数的基准。

aws controltower enable-baseline \ --baseline-identifier arn:aws:controltower:us-west-2::baseline/17BSJV3IGJ2QSGA2 \ --baseline-version 3.0 \ --target-identifier arn:aws:organizations::123456789012:ou/o-aq21sw43de5/ou-po90-lk87jh65 \ --region us-west-2

GetBaseline

有关此API操作的更多信息,请参阅GetBaseline

GetBaseline输入:

{ "baselineIdentifier": "arn:aws:controltower:us-west-2::baseline/17BSJV3IGJ2QSGA2" }

GetBaseline输出:

{ "arn": "arn:aws:controltower:us-west-2::baseline/17BSJV3IGJ2QSGA2", "name": "AWSControlTowerBaseline", "description": "Sets up resources and mandatory controls for member accounts within the target OU, required for AWS Control Tower governance.", }

GetBaselineCLI示例:

aws controltower get-baseline \ --baseline-identifier arn:aws:controltower:us-west-2::baseline/17BSJV3IGJ2QSGA2 \ --region us-west-2

GetBaselineOperation

有关此API操作的更多信息,请参阅GetBaselineOperation

GetBaselineOperation输入:

{ "operationIdentifier": "58f12232-26be-4735-a3e9-dd30d90f021f" }

GetBaselineOperation输出:

{ "baselineOperation": { "operationIdentifier": "58f12232-26be-4735-a3e9-dd30d90f021f", "operationType": "DISABLE_BASELINE", "status": "FAILED", "startTime": "2023-01-12T19:05:00Z", "endTime": "2023-01-12T19:45:00Z", "statusMessage": "Can't perform DisableBaseline on a parent target with governed child OUs" } }

GetBaselineOperationCLI示例:

aws controltower get-baseline-operation \ --operation-identifier 58f12232-26be-4735-a3e9-dd30d90f021f \ --region us-west-2

GetEnabledBaseline

有关此API操作的更多信息,请参阅GetEnabledBaseline

GetEnabledBaseline输入:

{ "enabledBaselineIdentifier": "arn:aws:controltower:us-west-2:123456789012:enabledbaseline/XAHCR4CJTSI4W07MZ" }

GetEnabledBaseline输出:

{ "enabledBaselineDetails": { "arn": "arn:aws:controltower:us-west-2:123456789012:enabledbaseline/XAHCR4CJTSI4W07MZ", "baselineIdentifier": "arn:aws:controltower:us-west-2::baseline:17BSJV3IGJ2QSGA2", "baselineVersion": "3.0", "targetIdentifier": "arn:aws:organizations::123456789012:ou/o-kgj0txdhpa/ou-r9mj-4j3mzjql", "statusSummary": { "status": "SUCCEEDED", "lastOperationIdentifier": "58f12232-26be-4735-a3e9-dd30d90f021f" }, "parameters": [ { "key": "IdentityCenterEnabledBaselineArn", "value": "arn:aws:controltower:us-west-2:123456789012:enabledbaseline/XAHCR4CJTSI4W07MZ" } ] } }

GetEnabledBaselineCLI示例:

aws controltower get-enabled-baseline \ --enabled-baseline-identifier arn:aws:controltower:us-west-2:123456789012:enabledbaseline/XAHXS7P6C4I453EZC \ --region us-west-2

ListBaselines

有关此API操作的更多信息,请参阅ListBaselines

ListBaselines输入(使用可选输入):

{ "nextToken": "AbCd1234", "maxResults": "4" }

ListBaselines输出:

{ "baselines": [ { "arn": "arn:aws:controltower:us-west-1::baseline/4T4HA1KMO10S6311", "name": "AuditBaseline", "description": "Sets up resources to monitor security and compliance of accounts in your organization." }, { "arn": "arn:aws:controltower:us-west-1::baseline/J8HX46AHS5MIKQPD", "name": "LogArchiveBaseline", "description": "Sets up a central repository for logs of API activities and resource configurations from accounts in your organization." }, { "arn": "arn:aws:controltower:us-west-1::baseline/LN25R72TTG6IGPTQ", "name": "IdentityCenterBaseline", "description": "Sets up shared resources for AWS Identity Center, which prepares the AWSControlTowerBaseline to set up Identity Center access for accounts." }, { "arn": "arn:aws:controltower:us-west-1::baseline/17BSJV3IGJ2QSGA2", "name": "AWSControlTowerBaseline", "description": "Sets up resources and mandatory controls for member accounts within the target OU, required for AWS Control Tower governance." } ] }

ListBaselinesCLI示例:

aws controltower list-baselines \ --region us-west-2

ListEnabledBaselines

有关此API操作的更多信息,请参阅ListEnabledBaselines

ListEnabledBaselines输入(无过滤器):

{ "nextToken": "bde7-XX0c6fXXXXXX", "maxResults": 5 }

ListEnabledBaselines输入(仅限baselineIdentifiers过滤器):

{ "filter": { "baselineIdentifiers": ['arn:aws:controltower:us-east-1::baseline/17BSJV3IGJ2QSGA2', 'arn:aws:controltower:us-east-1::baseline/12GZU8CKZKVMS2AW'] }, "nextToken": "bde7-XX0c6fXXXXXX", "maxResults": 5 }

ListEnabledBaselines输入(仅限targetIdentifiers过滤器):

{ "filter": { "targetIdentifiers": ['arn:aws:organizations::123456789012:ou/o-s9511vn103/ou-xqj7-fex1u317', 'arn:aws:organizations::123456789012:ou/o-s9511vn103/ou-xqj7-11q6n2cf'] }, "nextToken": "bde7-XX0c6fXXXXXX", "maxResults": 2 }

ListEnabledBaselines输入(baselineIdentifierstargetIdentifiers过滤器):

{ "filter": { "baselineIdentifiers": ['arn:aws:controltower:us-east-1::baseline/17BSJV3IGJ2QSGA2'] "targetIdentifiers": ['arn:aws:organizations::123456789012:ou/o-s9511vn103/ou-xqj7-fex1u317'] }, "nextToken": "bde7-XX0c6fXXXXXX", "maxResults": 5 }

ListEnabledBaselines输出:

{ "enabledBaselines": [ { "arn": "arn:aws:controltower:us-east-1:123456789012:enabledbaseline/XAHCR4CJTSI4W07MZ", "baselineIdentifier": "arn:aws:controltower:us-east-1::baseline:17BSJV3IGJ2QSGA2", "baselineVersion": "3.0", "targetIdentifier": "arn:aws:organizations::123456789012:ou/o-kgj0txdhpa/ou-r9mj-4j3mzjql", "statusSummary": { "status": "SUCCEEDED", "lastOperationIdentifier": "58f12232-26be-4735-a3e9-dd30d90f021f" } }, { "arn": "arn:aws:controltower:us-east-1:123456789012:enabledbaseline/XAJ9NKW88AA4W9CLL", "baselineIdentifier": "arn:aws:controltower:us-east-1::baseline:17BSJV3IGJ2QSGA2", "baselineVersion": "4.0", "targetIdentifier": "arn:aws:organizations::123456789012:ou/o-s9511vn103/ou-xqj7-fex1u317", "statusSummary": { "status": "FAILED", "lastOperationIdentifier": "81e02df1-2b4d-48f0-838f-3833b93dcdc0" } } ], "nextToken": "e2bXXXXX6cab" }

CLI使用一种过滤器(baselineIdentifiers过滤器)的示例:

aws controltower list-enabled-baselines \ --filter baselineIdentifiers=arn:aws:controltower:us-west-2::baseline/17BSJV3IGJ2QSGA2,arn:aws:controltower:us-west-2::baseline/LN25R72TTG6IGPTQ \ --region us-west-2

CLI使用多个过滤器(baselineIdentifierstargetIdentifiers过滤器)的示例:

aws controltower list-enabled-baselines \ --filter targetIdentifiers=arn:aws:organizations::123456789012:ou/o-aq21sw43de5/ou-po90-lk87jh65,baselineIdentifiers=arn:aws:controltower:us-west-2::baseline/17BSJV3IGJ2QSGA2 \ --region us-west-2

ResetEnabledBaseline

有关此API操作的更多信息,请参阅ResetEnabledBaseline

ResetEnabledbaseline输入:

{ "enabledBaselineIdentifier": "arn:aws:controltower:us-west-2:123456789012:enabledbaseline/XAJ9NKW88AA4W9CLL" }

ResetEnabledBaseline输出:

{ "operationIdentifier": "81e02df1-2b4d-48f0-838f-3833b93dcdc0" }

ResetEnabledBaselineCLI示例:

aws controltower reset-enabled-baseline \ --enabled-baseline-identifier arn:aws:controltower:us-west-2:123456789012:enabledbaseline/XAHXS7P6C4I453EZC \ --region us-west-2

UpdateEnabledBaseline

有关此API操作的更多信息,请参阅UpdateEnabledBaseline

UpdateEnabledBaseline输入:

{ "enabledBaselineIdentifier": "arn:aws:controltower:us-east-1:123456789012:enabledbaseline/XAJ9NKW88AA4W9CLL", "baselineVersion": "4.0", "parameters": [ { "key": "IdentityCenterEnabledBaselineArn", "value": "arn:aws:controltower:us-east-1:123456789012:enabledbaseline/XAHCR4CJTSI4W07MZ" } ] }

UpdateEnabledBaseline输出:

{ "operationIdentifier": "81e02df1-2b4d-48f0-838f-3833b93dcdc0" }

UpdateEnabledBaselineCLI示例:

aws controltower update-enabled-baseline \ --enabled-baseline-identifier arn:aws:controltower:us-west-2:123456789012:enabledbaseline/XAHXS7P6C4I453EZC \ --baseline-version 4.0 --parameters '[{"key":"IdentityCenterEnabledBaselineArn","value":"arn:aws:controltower:us-west-2:123456789012:enabledbaseline/XAHXS7P6C4I453EZC"}]' \ --region us-west-2