

# Amazon Outposts examples using Amazon CLI
<a name="cli_outposts_code_examples"></a>

The following code examples show you how to perform actions and implement common scenarios by using the Amazon Command Line Interface with Amazon Outposts.

*Actions* are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.

Each example includes a link to the complete source code, where you can find instructions on how to set up and run the code in context.

**Topics**
+ [Actions](#actions)

## Actions
<a name="actions"></a>

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

The following code example shows how to use `get-outpost-instance-types`.

**Amazon CLI**  
**To get the instance types on your Outpost**  
The following `get-outpost-instance-types` example gets the instance types for the specified Outpost.  

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

```
{
    "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"
}
```
For more information, see [Launch an instance on your Outpost](https://docs.aws.amazon.com/outposts/latest/userguide/launch-instance.html) in the *Amazon Outposts User Guide*.  
+  For API details, see [GetOutpostInstanceTypes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/outposts/get-outpost-instance-types.html) in *Amazon CLI Command Reference*. 

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

The following code example shows how to use `get-outpost`.

**Amazon CLI**  
**To get Outpost details**  
The following `get-outpost` example displays the details for the specified Outpost.  

```
aws outposts get-outpost \
    --outpost-id op-0ab23c4567EXAMPLE
```
Output:  

```
{
    "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": {}
    }
}
```
For more information, see [Working with Outposts](https://docs.aws.amazon.com/outposts/latest/userguide/work-with-outposts.html) in the *Amazon Outposts User Guide*.  
+  For API details, see [GetOutpost](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/outposts/get-outpost.html) in *Amazon CLI Command Reference*. 

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

The following code example shows how to use `list-outposts`.

**Amazon CLI**  
**To list Outposts**  
The following `list-outposts` example lists the Outposts in your Amazon account.  

```
aws outposts list-outposts
```
Output:  

```
{
    "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": {}
        }
    ]
}
```
For more information, see [Working with Outposts](https://docs.aws.amazon.com/outposts/latest/userguide/work-with-outposts.html) in the *Amazon Outposts User Guide*.  
+  For API details, see [ListOutposts](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/outposts/list-outposts.html) in *Amazon CLI Command Reference*. 

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

The following code example shows how to use `list-sites`.

**Amazon CLI**  
**To list sites**  
The following `list-sites` example lists the available Outpost sites in your Amazon account.  

```
aws outposts list-sites
```
Output:  

```
{
    "Sites": [
        {
            "SiteId": "os-0ab12c3456EXAMPLE",
            "AccountId": "123456789012",
            "Name": "EXAMPLE",
            "Description": "example",
            "Tags": {}
        }
    ]
}
```
For more information, see [Working with Outposts](https://docs.aws.amazon.com/outposts/latest/userguide/work-with-outposts.html) in the *Amazon Outposts User Guide*.  
+  For API details, see [ListSites](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/outposts/list-sites.html) in *Amazon CLI Command Reference*. 