VPC_Operations for the Amazon EC2 REST adapter

The following topic describes the adapter request and response for the VPC_Operations. 

Creat VPC operation

The Create VPC operation enables you to create a Virtual Private Cloud (VPC) with the Classless Inter-Domain Routing (CIDR) block that you specify. CIDR is a method for allocating IP addresses and routing packets.

The smallest VPC that you can create uses a /28 netmask (16 IP addresses) and the largest uses a /16 netmask (65,536 IP addresses).

The following figure shows a sample <items> XML element for the Create VPC operation. 

Sample <items> XML element for the Create VPC operation

<items>
  <item>
    <parameters>
      <cidr-block></cidr-block>
      <!--Optional:-->
      <instance-tenancy></instance-tenancy>
    </parameters>
  </item>
</items>

The following table describes the elements for this adapter request. 

Adapter request elements for the Create VPC operation

Element

Definition

Required

<access-key>

Specifies the Amazon Web Services (AWS) access key

You need to generate the AWS access key by going to the Security Credentials tab in the AWS console.

Conditional;

  • You must specify the Access Key and theSecret Key together in the configuration or the adapter request.
  • If you specify both the keys in the adapter request and in the adapter configuration, the key values in the request override the values in the configuration.
  • If only the Access Key is specified, the adapter ignores the value.
<secret-key>

Specifies the AWS secret access key

You need to generate the AWS secret access key by going to the Security Credentials tab in the AWS console.

Conditional;

  • You must specify the Access Key and theSecret Key together in the configuration or the adapter request.
  • If you specify both the keys in the adapter request and in the adapter configuration, the key values in the request override the values in the configuration.
  • If only the Secret Access Key is specified, the adapter ignores the value.
<region>

Specifies the region with which you want the adapter to communicate

Amazon EC2 is hosted in multiple locations world-wide. You must specify the region in which you want the adapter to perform the actions.

Valid values:

  • us-east-1
  • us-west-2 (default)
  • us-west-1
  • eu-west-1
  • ap-southeast-1
  • ap-northeast-1
  • ap-southeast-2
  • sa-east-1
No

<operation-name>

Contains the name of the operation:create-vpc

Yes

<parameters>

Contains the elements required to execute the operation

Yes

<cidr-block>

Specifies the CIDR block that you want the VPC to cover (for example, 10.0.0.0/16)

Yes

<instance-tenancy>

Specifies the allowed tenancy of instances launched into the VPC 

Valid values:

  • default (instances can be launched with any tenancy) (default)
  • dedicated (instances must be launched with tenancy as 'dedicated')

No

The following figure shows a sample adapter request for the Create VPC operation. 

Sample adapter request for the Create VPC operation

<amazon-ec2-rest-request>
    <operation-name>create-vpc</operation-name>
    <access-key>AKIA************BT2Q</access-key>
    <secret-key>WQisk8Irh*********************8AiJx3VQVd</secret-key>
    <region>us-east-1</region>            
    <parameters>
          <cidr-block>10.0.0.0/28</cidr-block>
          <!--Optional:-->
          <instance-tenancy>default</instance-tenancy>
    </parameters>
</amazon-ec2-rest-request>

The following figure shows the response for the sample Create VPC operation. 

Sample adapter response for the Create VPC operation

<amazon-ec2-rest-response>
    <metadata>
        <status>success</status>
    </metadata>
    <CreateVpcResponse>
        <vpc>
            <vpcId>vpc-6c836e09</vpcId>
            <state>pending</state>
            <cidrBlock>10.0.0.0/28</cidrBlock>
            <dhcpOptionsId>dopt-fadad298</dhcpOptionsId>
            <instanceTenancy>default</instanceTenancy>
        </vpc>
    </CreateVpcResponse>
</amazon-ec2-rest-response>

Describe VPC operation

The Describe VPCs operation enables you to retrieve information about your VPCs.

You can filter the results to return information only about those VPCs that match the criteria that you specify. For example, you could get information only about VPCs whose state is available. Also, you can specify multiple values for the filter. For example, the VPC uses one of several sets of DHCP options and the state of the VPC isavailable. However, at least one of the specified values must match a VPC to obtain results.

The result includes information for a particular VPC only if it matches all the specified filters. If there is no match, no special message is returned; the response is empty.

You can use wildcard characters with the filters:

  • Use the asterisk (*) to match any number of characters.
  • Use the question mark (?) to match a single character.

To escape a special character or metacharacter that has a special meaning in searches, precede the special character with a backslash (\ ).

The following table shows the available filters.

Filter Name

Description

cidr

Specifies the CIDR block of the VPC 

The CIDR block that you specify must exactly match the VPC's CIDR block to obtain results. Include a forward slash followed by one or two digits (for example, /28) before the CIDR block. 

Valid value: Any string

dchp-options-id

Specifies the ID for a set of DHCP options 

Valid value: Any string

state

Specifies the state of the VPC 

Valid values: pending, available

tag-key

Species the key assigned to a resource 

This filter is independent of the <tag-value> filter. For example, if you specify tag-key=Purpose and tag-value=X, the result includes all the resources that are assigned thePurpose tag key (regardless of the value of the tag), and the X tag value (regardless of the value of the tag key). If you want to list only resources where Purpose=X, see the tag:key filter. 

Valid value: Any string

tag-value

Specifies the value of the tag assigned to the resource 

This filter is independent of the <tag-key> filter. 

Valid value: Any string

tag:key

Filters the results based on a specific tag-value combination 

For example, to list the resources assigned the Purpose=X tag, specify 

name=tag:Purpose 

value=X

vpc-id

Specifies the ID of the VPC 

Valid value: Any string

The following figure shows a sample <items> XML element for the Describe VPCs operation. 

Sample <items> XML element for the Describe VPCs operation

<items>
  <item>
    <parameters>
      <!--Optional:-->
      <vpc-set>
        <!--Zero or more repetition-->
        <item>
          <vpc-id></vpc-id>
        </item>
      </vpc-set>
      <!--Optional:-->
      <filter-set>
        <!--Zero or more repetition-->
        <item>
          <name></name>
          <value-set>
            <!--Zero or more repetition-->
            <item>
              <value></value>
            </item>
          </value-set>
        </item>
      </filter-set>
    </parameters>
  </item>
</items>

The following table describes the elements for this adapter request. 

Adapter request elements for the Describe VPCs operation

Element

Definition

Required

<access-key>

Specifies the Amazon Web Services (AWS) access key

You need to generate the AWS access key by going to the Security Credentials tab in the AWS console.

Conditional;

  • You must specify the Access Key and theSecret Key together in the configuration or the adapter request.
  • If you specify both the keys in the adapter request and in the adapter configuration, the key values in the request override the values in the configuration.
  • If only the Access Key is specified, the adapter ignores the value.
<secret-key>

Specifies the AWS secret access key

You need to generate the AWS secret access key by going to the Security Credentials tab in the AWS console.

Conditional;

  • You must specify the Access Key and theSecret Key together in the configuration or the adapter request.
  • If you specify both the keys in the adapter request and in the adapter configuration, the key values in the request override the values in the configuration.
  • If only the Secret Access Key is specified, the adapter ignores the value.
<region>

Specifies the region with which you want the adapter to communicate

Amazon EC2 is hosted in multiple locations world-wide. You must specify the region in which you want the adapter to perform the actions.

Valid values:

  • us-east-1
  • us-west-2 (default)
  • us-west-1
  • eu-west-1
  • ap-southeast-1
  • ap-northeast-1
  • ap-southeast-2
  • sa-east-1
No

<operation-name>

Contains the name of the operation: describe-vpcs

Yes

<parameters>

Contains the elements required to execute the operation

Yes

<vpc-set>

Specifies the details of the VPC IDs whose information you want to retrieve

No

<filter-set>

Specifies the details of the filter that is used to retrieve specific information

No

The following figure shows a sample adapter request for the Describe VPCs operation using cidr as a filter. 

Sample adapter request for the Describe VPCs operation

<amazon-ec2-rest-request>
    <operation-name>describe-vpcs</operation-name>    
    <access-key>AKIA************BT2Q</access-key>
    <secret-key>WQisk8Irh********************8AiJx3VQVd</secret-key>
    <region>us-east-1</region>
    <parameters>
          <!--Optional:-->
          <vpc-set>
            <!--Zero or more repetition-->
            <item>
                  <vpc-id></vpc-id>
            </item>
          </vpc-set>
          <!--Optional:-->
          <filter-set>
            <!--Zero or more repetition-->
            <item>
                  <name>cidr</name>
                  <value-set>
                    <!--Zero or more repetition-->
                    <item>
                          <value>10.0.0.0/28</value>
                    </item>
                  </value-set>
            </item>
          </filter-set>
    </parameters>
</amazon-ec2-rest-request>

The following figure shows the response for the sample Describe VPCs operation using cidr as a filter. 

Sample adapter response for the Describe VPCs operation

<amazon-ec2-rest-response>
    <metadata>
        <status>success</status>
    </metadata>
    <DescribeVpcsResponse>
        <vpcSet>
            <item>
                <vpcId>vpc-6c836e09</vpcId>
                <state>available</state>
                <cidrBlock>10.0.0.0/28</cidrBlock>
                <dhcpOptionsId>dopt-fadad298</dhcpOptionsId>
                <instanceTenancy>default</instanceTenancy>
            </item>
        </vpcSet>
    </DescribeVpcsResponse>
</amazon-ec2-rest-response>

Delete VPC operation

The Delete VPC operation enables you to delete a VPC. You must first detach or delete all gateways or other objects that depend on the VPC. For example, you must terminate all running instances, delete all VPC security groups (except the default), delete all the route tables (except the default), and so on before deleting the VPC.

The following figure shows a sample <items> XML element for the Delete VPC operation. 

Sample <items> XML element for the Delete VPC operation

<items>
  <item>
    <parameters>
      <vpc-id></vpc-id>
    </parameters>
  </item>
</items>

The following table describes the elements for this adapter request. 

Adapter request elements for the Delete VPC operation

Element

Definition

Required

<access-key>

Specifies the Amazon Web Services (AWS) access key

You need to generate the AWS access key by going to the Security Credentials tab in the AWS console.

Conditional;

  • You must specify the Access Key and theSecret Key together in the configuration or the adapter request.
  • If you specify both the keys in the adapter request and in the adapter configuration, the key values in the request override the values in the configuration.
  • If only the Access Key is specified, the adapter ignores the value.
<secret-key>

Specifies the AWS secret access key

You need to generate the AWS secret access key by going to the Security Credentials tab in the AWS console.

Conditional;

  • You must specify the Access Key and theSecret Key together in the configuration or the adapter request.
  • If you specify both the keys in the adapter request and in the adapter configuration, the key values in the request override the values in the configuration.
  • If only the Secret Access Key is specified, the adapter ignores the value.
<region>

Specifies the region with which you want the adapter to communicate

Amazon EC2 is hosted in multiple locations world-wide. You must specify the region in which you want the adapter to perform the actions.

Valid values:

  • us-east-1
  • us-west-2 (default)
  • us-west-1
  • eu-west-1
  • ap-southeast-1
  • ap-northeast-1
  • ap-southeast-2
  • sa-east-1
No

<operation-name>

Contains the name of the operation: delete-vpc

Yes

<parameters>

Contains the <vpc-id> element required to execute the operation

Yes

<vpc-id>

Specifies the ID of the VPC that you want to delete

Yes

The following figure shows a sample adapter request for the Delete VPC operation. 

Sample adapter request for the Delete VPC operation

<amazon-ec2-rest-request>
    <operation-name>delete-vpc</operation-name>
    <access-key>AKIA************BT2Q</access-key>
    <secret-key>WQisk8Irh********************8AiJx3VQVd</secret-key>
    <region>us-east-1</region>    
    <parameters>
          <vpc-id>vpc-6c836e09</vpc-id>
    </parameters>
</amazon-ec2-rest-request>

The following figure shows the response for the sample Delete VPC operation. 

Sample adapter response for the Delete VPC operation

<amazon-ec2-rest-response>
    <metadata>
        <status>success</status>
    </metadata>
    <DeleteVpcResponse>
        <return>true</return>
    </DeleteVpcResponse>
</amazon-ec2-rest-response>
Was this page helpful? Yes No Submitting... Thank you

Comments