基准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 组织启用基准,该着陆区已选择接入 Cont AWS rol Tower 管理的 AWS IAM 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-east-1::baseline/4T4HA1KMO10S6311", "name": "AuditBaseline", "description": "Sets up resources to monitor security and compliance of accounts in your organization." }, { "arn": "arn:aws:controltower:us-east-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-east-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-east-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." }, { "arn": "arn:aws:controltower:us-east-1::baseline/3WPD0NA6TJ9AOMU2", "name": "BackupCentralVaultBaseline", "description": "Sets up central AWS Backup vault in your organization." }, { "arn": "arn:aws:controltower:us-east-1::baseline/H6C5JFCJJ3CPU3J5", "name": "BackupManagerBaseline", "description": "Sets up delegated admin and AWS Backup Audit Manager." }, { "arn": "arn:aws:controltower:us-east-1::baseline/APO9ATVPBKFRRGLK", "name": "BackupBaseline", "description": "Sets up local Backup vault and attach Backup policy." } ] }

ListBaselinesCLI示例:

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

ListEnabledBaselines

ListEnabledBaselinesAPI有一个可选参数,允许您查看适用于作为 OU 成员账户的基准。以下示例显示了一些可用于查看账户基准的CLI命令。 AWSControl Tower 将这些基准称为启用子项的基准,这些基准在 OU 上启用,但应用于 OU 中的每个账户,因为它们的治理配置来自应用于 OU 的基准。

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

ListEnabledBaselines用于显示启用子项的基线的输入:

aws controltower list-enabled-baselines --include-children

ListEnabledBaselines查看启用子项的基线的输出:

{ "enabledBaselines": [ { "arn": "arn:aws:controltower:us-east-1:666355521292:enabledbaseline/XO2UQ1PC6BB5085S5", "baselineIdentifier": "arn:aws:controltower:us-east-1::baseline/APO9ATVPBKFRRGLK", "baselineVersion": "1.0", "statusSummary": { "lastOperationIdentifier": "07d6d2b8-e357-4f96-ba00-98ea88143445", "status": "SUCCEEDED" }, "targetIdentifier": "arn:aws:organizations::666355521292:ou/o-vaex10vaey/ou-k86y-ld9k8vpu" }, { "arn": "arn:aws:controltower:us-east-1:666355521292:enabledbaseline/XAFPKQQXOJB50ZWQH", "baselineIdentifier": "arn:aws:controltower:us-east-1::baseline/APO9ATVPBKFRRGLK", "baselineVersion": "1.0", "parentIdentifier": "arn:aws:controltower:us-east-1:666355521292:enabledbaseline/XOIZ4G08CWB50ZWON", "statusSummary": { "lastOperationIdentifier": "3508793e-48c8-4895-965b-3dc6abd52b6b", "status": "SUCCEEDED" }, "targetIdentifier": "arn:aws:organizations::666355521292:account/o-vaex10vaey/183295447314" } ]
注意

在前面的示例中,该parentIdentifier字段显示了父组织单位为此启用子项的基准的启用基线。

查看应用于特定目标(OU 或账户)的所有基准:

aws controltower list-enabled-baselines \ --filter '{ "targetIdentifiers": ["TARGET_ARN"] }

查看所有OUs具有特定基准的内容:

aws controltower list-enabled-baselines \ --filter '{ "baselineIdentifiers": ["BASELINE_ARN"] }'

查看所有具有特定基准的账户OUs和账户:

aws controltower list-enabled-baselines \ --filter '{ "baselineIdentifiers": ["BASELINE_ARN"] }' \ --include-children

查看 OU 中所有启用了基准 B 的账户:

### First fetch the enabled baseline record for Baseline B on the OU aws controltower list-enabled-baselines \ --filter '{ "targetIdentifiers": ["OU_TARGET_ARN"], "baselineIdentifiers": ["BASELINE_ARN_FOR_BASELINE_B"] }' ### Call ListEnabled baseline to fetch all accounts that have their parent as the enabled baseline record on the OU aws controltower list-enabled-baselines \ --filter '{ "parentIdentifiers": ["ENABLED_BASELINE_ARN_FOR_OU"] }' \ --include-children
有关启用子女的基准的更多信息
  • 您可以使用GetEnabledBaselineAPI来查看有关启用子项的特定基线的详细信息

  • 您可以使用GetBaselineOperationAPI来查看在启用子项的基线上执行的操作

  • 您不能直接在启用子项的EnableBaseline基准上调用任何写入APIs,例如UpdateEnabledBaselineDisableBaselineResetEnabledBaseline或。

  • 启用子项的基准资源只能通过 Cont AWS rol Tower 服务、通过在父 OU 上执行的操作或通过 Account Factory 进行修改。

使用过滤器的示例:

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