すべてのプロダクト
Search
ドキュメントセンター

Virtual Private Cloud:DeleteVpc

最終更新日:Jun 19, 2026

DeleteVpc 操作を呼び出して、仮想プライベートクラウド (VPC) を削除します。

操作説明

この操作を呼び出して VPC を削除する際、以下の点に注意してください:

  • VPC を削除する前に、vSwitch、クラウドプロダクトインスタンス、高可用性仮想 IP アドレス (HAVIP) など、VPC 内のすべてのリソースをリリースまたは移行する必要があります。

  • Available 状態の VPC のみ削除できます。

  • DeleteVpc 操作は非同期です。リクエストが送信されると、リクエスト ID が返されますが、VPC はすぐには削除されません。削除タスクはバックグラウンドで続行されます。 DescribeVpcAttribute 操作を呼び出して、VPC の削除ステータスをクエリできます:

    • VPC が Deleting 状態の場合、VPC は削除中です。

    • 指定された VPC が見つからない場合、VPC は削除されています。

  • DeleteVpc 操作は、同じ VPC の同時削除をサポートしていません。

今すぐお試しください

この API を OpenAPI Explorer でお試しください。手作業による署名は必要ありません。呼び出しに成功すると、入力したパラメーターに基づき、資格情報が組み込まれた SDK コードが自動的に生成されます。このコードをダウンロードしてローカルで使用できます。

テスト

RAM 認証

下表に、この API を呼び出すために必要な認証情報を示します。認証情報は、RAM (Resource Access Management) ポリシーを使用して定義できます。以下で各列名について説明します。

  • アクション:特定のリソースに対して実行可能な操作。ポリシー構文ではAction要素として指定します。

  • API:アクションを具体的に実行するための API。

  • アクセスレベル:各 API に対して事前定義されているアクセスの種類。有効な値:create、list、get、update、delete。

  • リソースタイプ:アクションが作用するリソースの種類。リソースレベルでの権限をサポートするかどうかを示すことができます。ポリシーの有効性を確保するため、アクションの対象として適切なリソースを指定してください。

    • リソースレベルの権限を持つ API の場合、必要なリソースタイプはアスタリスク (*) でマークされます。ポリシーのResource要素で対応する ARN を指定してください。

    • リソースレベルの権限を持たない API の場合、「すべてのリソース」と表示され、ポリシーのResource要素でアスタリスク (*) でマークされます。

  • 条件キー:サービスによって定義された条件のキー。このキーにより、きめ細やかなアクセス制御が可能になります。この制御は、アクション単体に適用することも、特定のリソースに対するアクションに適用することもできます。Alibaba Cloud は、サービス固有の条件キーに加えて、すべての RAM 統合サービスに適用可能な一連の共通条件キーを提供しています。

  • 依存アクション:ある特定のアクションを実行するために、前提として実行が必要となる他のアクション。依存アクションの権限も RAM ユーザーまたは RAM ロールに付与する必要があります。

アクション

アクセスレベル

リソースタイプ

条件キー

依存アクション

vpc:DeleteVpc

delete

*VPC

acs:vpc:{#regionId}:{#accountId}:vpc/{#VpcId}

  • vpc:tag
なし

リクエストパラメーター

パラメーター

必須 / 任意

説明

VpcId

string

必須

削除する VPC の ID。

vpc-bp1m7v25emi1h5mtc****

RegionId

string

任意

削除する VPC のリージョン ID。

DescribeRegions 操作を呼び出して、リージョン ID をクエリできます。

cn-hangzhou

ForceDelete

boolean

任意

VPC を強制的に削除するかどうかを指定します。有効な値:

  • true: VPC を強制的に削除します。

  • false (デフォルト): VPC を強制的に削除しません。

VPC を強制的に削除できるのは、VPC 内に以下のリソースが存在する場合のみです:

  • VPC に IPv4 ゲートウェイと IPv4 ゲートウェイを指すルートのみが含まれている場合。

  • VPC に IPv6 ゲートウェイと IPv6 ゲートウェイを指すルートのみが含まれている場合。

false

DryRun

boolean

任意

ドライランを実行するかどうかを指定します。有効な値:

  • true: 実際に VPC を削除せずにドライランを実行します。システムは、必須パラメーターが設定されているか、リクエストフォーマットが有効か、ビジネス制限が満たされているかを確認します。確認が失敗した場合、対応するエラーが返されます。確認が成功した場合、エラーコード DryRunOperation が返されます。

  • false (デフォルト): ドライランを実行し、リクエストを送信します。確認が成功した場合、HTTP 2xx 状態コードが返され、VPC が直接削除されます。

false

ClientToken

string

任意

リクエストのべき等性を確保するために使用されるクライアントトークン。

クライアントを使用してトークンを生成できますが、異なるリクエスト間でトークンが一意であることを確認する必要があります。ClientToken の値には ASCII 文字のみを含めることができます。

説明

このパラメーターを指定しない場合、システムは API リクエストの RequestIdClientToken として使用します。RequestId は API リクエストごとに異なる場合があります。

123e4567-e89b-12d3-a456-426655440000

レスポンスフィールド

フィールド

説明

object

リクエスト ID。

RequestId

string

リクエスト ID。

0ED8D006-F706-4D23-88ED-E11ED28DCAC0

成功レスポンス

JSONJSON

{
  "RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}

エラーコード

HTTP ステータスコード

エラーコード

エラーメッセージ

説明

400 IncorrectStatus.VpcDhcpStatus The DhcpOptionsSet status of vpc does not support this operation.
400 DependencyViolation.GatewayEndpoint The VPC contains endpoints and cannot be deleted.
400 IncorrectVpcStatus Current VPC status does not support this operation.
400 DependencyViolation.RouteEntry Specified object has dependent resources 依存関係があるカスタマイズルーティングルールが存在するため、VPC を削除できませんでした。
400 DependencyViolation.Instance Specified object has dependent resources
400 DependencyViolation.VSwitch Specified object has dependent resources 依存関係がある VSwitch が存在するため、VPC を削除できませんでした。
400 DependencyViolation.RouteInterface Specified object has dependent route interface .
400 DependencyViolation.Tunnel Specified object has dependent tunnel.
400 DependencyViolation.NatGateway Specified object has dependent resources NatGateway. VPC には NATGateway があるため、削除できません。VPC 内の NATGateway を削除してから、VPC を削除してください。
400 DependencyViolation.RouterInterface Specified object has dependent resources RouterInterface.
400 DependencyViolation.SecurityGroup Specified object has dependent resources SecurityGroup.
400 Forbidden.VpcNotFound Specified VPC can not found. 指定された VPC は存在しません。
400 Forbbiden Active custom route in vpc.
400 TaskConflict The eip operate too frequent, TaskConflict.
400 InvalidAction The VPC has been connected to the classic network ECS. Please cancel the connection before proceeding.
400 IncorrectStatus.cbnStatus Current CBN status does not support this operation.
400 DependencyViolation.RouteTable Specified object has dependent custom routeTable.
400 DependencyViolation.NetworkAcl Specified object has dependent resources network acl.
400 DependencyViolation.ClassicLinkInstance Specified object has active classicLink instance.
400 System.ServiceBusy System is busy, please try later.
400 DependencyViolation.DhcpOptionsSet The VPC cannot be deleted when it is associated with dhcpOptionsSet.
400 InvalidRegionId.NotFound The specified region is not found.
400 DependencyViolation.CustomRouteTable CustomRouteTable already exists.
400 DependencyViolation.Ipv4Gateway The VPC cannot be deleted when it has ipv4Gateway.
400 DependencyViolation.GatewayRouteTable Specified object has dependent resources gatewayRouteTable.
400 OperationDenied.VpcPeerExists The operation is not allowed because the VpcPeer exists.
400 DependencyViolation.AppAccess Specified object has dependent resources app access.
400 DependencyViolation.OppositeRouterInterface Failed to delete the VPC because it has peer router interfaces.
400 DependencyViolation.TransitRouter Specified object has attached to Transit Router.
400 DependencyViolation.Ipv6Gateway The VPC contains IPv6Gateway and cannot be deleted.
400 DependencyViolation.CloudServiceResource The VPC contains CloudServiceResource and cannot be deleted.
400 IncorrectStatus.VpcDnsHostnameStatus The DnsHostname status of vpc does not support this operation.
400 OperationDenied.AttachedToECR The operation is not allowed because the VPC is attached to ECR %s.
500 InternalError The request processing has failed due to some unknown error.
403 OperationDenied The operation is not supported in this status.
404 InvalidVpcId.NotFound Specified VPC does not exist.

完全なリストについては、「エラーコード」をご参照ください。

変更履歴

完全なリストについては、「変更履歴」をご参照ください。