使用 AWS CLI 的 AWS Outposts 範例 - AWS Command Line Interface

使用 AWS CLI 的 AWS Outposts 範例

下列程式碼範例示範如何使用 AWS Command Line Interface 搭配 AWS Outposts 來執行動作,並實作常見案例。

Actions 是大型程式的程式碼摘錄,必須在內容中執行。雖然動作會告訴您如何呼叫個別服務函數,但您可以在其相關情境中查看內容中的動作。

每個範例均包含完整原始程式碼的連結,您可在連結中找到如何在內容中設定和執行程式碼的相關指示。

主題

動作

以下程式碼範例顯示如何使用 get-outpost-instance-types

AWS CLI

取得 Outpost 上的執行個體類型

下列 get-outpost-instance-types 範例會取得指定 Outpost 的執行個體類型。

aws outposts get-outpost-instance-types \ --outpost-id op-0ab23c4567EXAMPLE

輸出:

{ "InstanceTypes": [ { "InstanceType": "c5d.large" }, { "InstanceType": "i3en.24xlarge" }, { "InstanceType": "m5d.large" }, { "InstanceType": "r5d.large" } ], "OutpostId": "op-0ab23c4567EXAMPLE", "OutpostArn": "arn:aws:outposts:us-west-2:123456789012:outpost/op-0ab23c4567EXAMPLE" }

如需詳細資訊,請參閱《AWS Outposts 使用者指南》中的在 Outpost 上啟動執行個體

以下程式碼範例顯示如何使用 get-outpost

AWS CLI

取得 Outpost 詳細資訊

下列 get-outpost 範例顯示指定 Outpost 的詳細資訊。

aws outposts get-outpost \ --outpost-id op-0ab23c4567EXAMPLE

輸出:

{ "Outpost": { "OutpostId": "op-0ab23c4567EXAMPLE", "OwnerId": "123456789012", "OutpostArn": "arn:aws:outposts:us-west-2:123456789012:outpost/op-0ab23c4567EXAMPLE", "SiteId": "os-0ab12c3456EXAMPLE", "Name": "EXAMPLE", "LifeCycleStatus": "ACTIVE", "AvailabilityZone": "us-west-2a", "AvailabilityZoneId": "usw2-az1", "Tags": {} } }

如需詳細資訊,請參閱《AWS Outposts 使用者指南》中的使用 Outpost

  • 如需 API 詳細資訊,請參閱《AWS CLI 命令參考》中的 GetOutpost

以下程式碼範例顯示如何使用 list-outposts

AWS CLI

列出 Outpost

下列 list-outposts 範例會列出 AWS 帳戶中的 Outpost。

aws outposts list-outposts

輸出:

{ "Outposts": [ { "OutpostId": "op-0ab23c4567EXAMPLE", "OwnerId": "123456789012", "OutpostArn": "arn:aws:outposts:us-west-2:123456789012:outpost/op-0ab23c4567EXAMPLE", "SiteId": "os-0ab12c3456EXAMPLE", "Name": "EXAMPLE", "Description": "example", "LifeCycleStatus": "ACTIVE", "AvailabilityZone": "us-west-2a", "AvailabilityZoneId": "usw2-az1", "Tags": { "Name": "EXAMPLE" } }, { "OutpostId": "op-4fe3dc21baEXAMPLE", "OwnerId": "123456789012", "OutpostArn": "arn:aws:outposts:us-west-2:123456789012:outpost/op-4fe3dc21baEXAMPLE", "SiteId": "os-0ab12c3456EXAMPLE", "Name": "EXAMPLE2", "LifeCycleStatus": "ACTIVE", "AvailabilityZone": "us-west-2a", "AvailabilityZoneId": "usw2-az1", "Tags": {} } ] }

如需詳細資訊,請參閱《AWS Outposts 使用者指南》中的使用 Outpost

  • 如需 API 詳細資訊,請參閱《AWS CLI 命令參考》中的 ListOutposts

以下程式碼範例顯示如何使用 list-sites

AWS CLI

列出網站

下列 list-sites 範例會列出您 AWS 帳戶中可用的 Outpost 網站。

aws outposts list-sites

輸出:

{ "Sites": [ { "SiteId": "os-0ab12c3456EXAMPLE", "AccountId": "123456789012", "Name": "EXAMPLE", "Description": "example", "Tags": {} } ] }

如需詳細資訊,請參閱《AWS Outposts 使用者指南》中的使用 Outpost

  • 如需 API 詳細資訊,請參閱《AWS CLI 命令參考》中的 ListSites