CancelReservedInstancesListingCommand

Cancels the specified Reserved Instance listing in the Reserved Instance Marketplace.

For more information, see Sell in the Reserved Instance Marketplace  in the Amazon EC2 User Guide.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { EC2Client, CancelReservedInstancesListingCommand } from "@aws-sdk/client-ec2"; // ES Modules import
// const { EC2Client, CancelReservedInstancesListingCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
const client = new EC2Client(config);
const input = { // CancelReservedInstancesListingRequest
  ReservedInstancesListingId: "STRING_VALUE", // required
};
const command = new CancelReservedInstancesListingCommand(input);
const response = await client.send(command);
// { // CancelReservedInstancesListingResult
//   ReservedInstancesListings: [ // ReservedInstancesListingList
//     { // ReservedInstancesListing
//       ClientToken: "STRING_VALUE",
//       CreateDate: new Date("TIMESTAMP"),
//       InstanceCounts: [ // InstanceCountList
//         { // InstanceCount
//           InstanceCount: Number("int"),
//           State: "available" || "sold" || "cancelled" || "pending",
//         },
//       ],
//       PriceSchedules: [ // PriceScheduleList
//         { // PriceSchedule
//           Active: true || false,
//           CurrencyCode: "USD",
//           Price: Number("double"),
//           Term: Number("long"),
//         },
//       ],
//       ReservedInstancesId: "STRING_VALUE",
//       ReservedInstancesListingId: "STRING_VALUE",
//       Status: "active" || "pending" || "cancelled" || "closed",
//       StatusMessage: "STRING_VALUE",
//       Tags: [ // TagList
//         { // Tag
//           Key: "STRING_VALUE",
//           Value: "STRING_VALUE",
//         },
//       ],
//       UpdateDate: new Date("TIMESTAMP"),
//     },
//   ],
// };

CancelReservedInstancesListingCommand Input

Parameter
Type
Description
ReservedInstancesListingId
Required
string | undefined

The ID of the Reserved Instance listing.

CancelReservedInstancesListingCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
ReservedInstancesListings
ReservedInstancesListing[] | undefined

The Reserved Instance listing.

Throws

Name
Fault
Details
EC2ServiceException
Base exception class for all service exceptions from EC2 service.