发现资源 - Cloud Control API
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

发现资源

使用 list-resources 命令可以发现 Amazon Web Services 账户 和 Amazon Web Services 区域中当前预置的资源。这包括指定资源类型的所有资源,无论它们是通过 Cloud Control API、直接通过底层服务还是其他机制(例如作为 Amazon CloudFormation 堆栈的一部分)进行配置。

为每种资源返回的信息包括:

  • 此资源的主标识符。

  • 或者,它可以包括部分或全部资源的属性,并详细说明资源的当前状态。有关更多信息,请参阅 查看资源类型架构

以下示例将返回 AWS::Logs::LogGroup 资源的列表。

$ aws cloudcontrol list-resources --type-name AWS::Logs::LogGroup

Cloud Control API 会返回账户中指定资源类型的资源列表。例如,list-resources 会返回账户中所有 AWS::Logs::LogGroup 资源的主标识符和资源属性,而与这些资源是否由 Cloud Control API 预置无关。返回的信息类似于以下内容,具体取决于账户中的资源。

{ "TypeName": "AWS::Logs::LogGroup", "ResourceDescriptions": [ { "Identifier": "CloudControlExample", "Properties": '{"RetentionInDays":180, "LogGroupName": "CloudControlExample", "Arn": "arn:aws:logs:us-west-2:123456789012:log-group:CloudControlExample:*"}' }, { "Identifier": "AnotherLogGroupResourceExample", "Properties": '{"RetentionInDays":90, "LogGroupName": "AnotherLogGroupResourceExample", "Arn": "arn:aws:logs:us-west-2:123456789012:log-group:AnotherLogGroupResourceExample:*"}' } ] }

以下示例将请求一系列 AWS::Kinesis::Stream 资源。

$ aws cloudcontrol list-resources --type-name AWS::Kinesis::Stream

对于 Kinesis 流,Cloud Control API 会返回每个流的主标识符以及资源属性的子集。在本例中,只是一个 Name 属性。然后,您可以将流的主标识符与 get-resource 结合使用,以请求资源的完整当前状态。

{ "TypeName": "AWS::Kinesis::Stream", "ResourceDescriptions": [ { "Identifier": "MyKinesisStream", "Properties": '{"Name": "MyKinesisStream"}' }, { "Identifier": "AnotherStream", "Properties": '{"Name": "AnotherStream"}' } ] }

需要其他信息的资源

某些资源要求您提供有关要在请求中列出的资源的更多信息。在这些情况下,必须使用 ResourceModel 参数指定这些属性。

下表列出了这些资源,以及您在列出请求期间在 ResourceModel 参数中指定的属性。

资源 必需属性

AWS::ApiGateway::DocumentationVersion

RestApiId

AWS::ApiGateway::Step

RestApiId

AWS::CloudFormation::ResourceVersion

TypeArnTypeName

AWS::CustomerProfiles::Integration

DomainName

AWS::CustomerProfiles::ObjectType

DomainName

AWS::EC2::TransitGatewayMulticastGroupMember

TransitGatewayMulticastDomainId

AWS::EC2::TransitGatewayMulticastGroupSource

TransitGatewayMulticastDomainId

AWS::ECS::TaskSet

ClusterServiceID

AWS::EKS::AddOn

ClusterName

AWS::EKS::FargateProfile

ClusterName

AWS::ElasticLoadBalancingV2::Listener

LoadBalancerArn

AWS::ElasticLoadBalancingV2::ListenerRule

ListenerArn

AWS::Glue::Attach::SchemaVersion

  • SchemaDefinitionSchema/RegistryNameSchema/SchemaName

  • SchemaDefinitionSchema/SchemaArn

AWS::Glue::Attach::SchemaVersionMetadata

SchemaVersionId

AWS::IoTSiteWise::AccessPolicy

  • /AccessPolicyResource/Portal

  • /AccessPolicyResource/Project

AWS::IoTSiteWise::Dashboard

ProjectId

AWS::IoTSiteWise::Project

PortalId

AWS::Kendra::DataSource

IndexId

AWS::Kendra::Faq

IndexId

AWS::MediaConnect::FlowEntitlement

FlowArn

AWS::MediaConnect::FlowOutput

FlowArn

AWS::MediaConnect::FlowSource

FlowArn

AWS::MediaConnect::FlowVpcInterface

FlowArn

AWS::MediaPackage::Asset

PackagingGroupId

AWS::MediaPackage::PackagingConfiguration

PackagingGroupId

AWS::NetworkFirewall::LoggingConfiguration

  • FirewallArn

  • FirewallName

AWS::QuickSight::Analysis

AwsAccountId

AWS::QuickSight::Dashboard

AwsAccountId

AWS::QuickSight::DataSet

AwsAccountId

AWS::QuickSight::DataSource

AwsAccountId

AWS::QuickSight::Template

AwsAccountId

AWS::QuickSight::Theme

AwsAccountId

AWS::RDS::DBProxyTargetGroup

DBProxyName

AWS::S3Outposts::AccessPoint

Bucket

AWS::S3Outposts::Bucket

OutpostId

AWS::SSO::Assignment

InstanceArnPermissionSetArnPrincipalIdPrincipalTypeTargetIdTargetType

AWS::SSO::InstanceAccessControlAttributeConfiguration

InstanceArn

AWS::SSO::PermissionSet

InstanceArnPermissionSetArn

AWS::WAFv2::WebACL

Scope