

文档 AWS SDK 示例 GitHub 存储库中还有更多 [S AWS DK 示例](https://github.com/awsdocs/aws-doc-sdk-examples)。

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

# AWS Outposts 使用示例 AWS CLI
<a name="cli_2_outposts_code_examples"></a>

以下代码示例向您展示了如何使用with来执行操作和实现常见场景 AWS Outposts。 AWS Command Line Interface 

*操作*是大型程序的代码摘录，必须在上下文中运行。您可以通过操作了解如何调用单个服务函数，还可以通过函数相关场景的上下文查看操作。

每个示例都包含一个指向完整源代码的链接，您可以从中找到有关如何在上下文中设置和运行代码的说明。

**Topics**
+ [操作](#actions)

## 操作
<a name="actions"></a>

### `get-outpost-instance-types`
<a name="outposts_GetOutpostInstanceTypes_cli_2_topic"></a>

以下代码示例演示了如何使用 `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 中启动实例](https://docs.aws.amazon.com/outposts/latest/userguide/launch-instance.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetOutpostInstanceTypes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/outposts/get-outpost-instance-types.html)*中的。

### `get-outpost`
<a name="outposts_GetOutpost_cli_2_topic"></a>

以下代码示例演示了如何使用 `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 用户指南》中的[使用 Outposts](https://docs.aws.amazon.com/outposts/latest/userguide/work-with-outposts.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetOutpost](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/outposts/get-outpost.html)*中的。

### `list-outposts`
<a name="outposts_ListOutposts_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-outposts`。

**AWS CLI**  
**列出 Outposts**  
以下`list-outposts`示例列出了您 AWS 账户中的Outposts。  

```
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 用户指南》中的[使用 Outposts](https://docs.aws.amazon.com/outposts/latest/userguide/work-with-outposts.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListOutposts](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/outposts/list-outposts.html)*中的。

### `list-sites`
<a name="outposts_ListSites_cli_2_topic"></a>

以下代码示例演示了如何使用 `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 用户指南》中的[使用 Outposts](https://docs.aws.amazon.com/outposts/latest/userguide/work-with-outposts.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListSites](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/outposts/list-sites.html)*中的。