AWS SDK 또는 CLI와 DeleteVpcEndpoints 함께 사용 - Amazon Elastic Compute Cloud

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

AWS SDK 또는 CLI와 DeleteVpcEndpoints 함께 사용

다음 코드 예제는 DeleteVpcEndpoints의 사용 방법을 보여 줍니다.

CLI
AWS CLI

엔드포인트 삭제

이 예시에서는 엔드포인트 vpce-aa22bb33 및 vpce-1a2b3c4d를 삭제합니다. 명령이 부분적으로 성공하거나 실패한 경우 실패한 항목의 목록이 반환됩니다. 명령이 성공하면 반환된 목록은 비어 있습니다.

명령:

aws ec2 delete-vpc-endpoints --vpc-endpoint-ids vpce-aa22bb33 vpce-1a2b3c4d

출력:

{ "Unsuccessful": [] }
  • API 세부 정보는 AWS CLI 명령 참조DeleteVpcEndpoints 섹션을 참조하세요.

PHP
SDK for PHP
참고

GitHub에 더 많은 내용이 있습니다. AWS 코드 예시 리포지토리에서 전체 예시를 찾고 설정 및 실행하는 방법을 배워보세요.

/** * @param string $vpcEndpointId * @return void */ public function deleteVpcEndpoint(string $vpcEndpointId) { try { $this->ec2Client->deleteVpcEndpoints([ "VpcEndpointIds" => [$vpcEndpointId], ]); }catch (Ec2Exception $caught){ echo "There was a problem deleting the VPC Endpoint: {$caught->getAwsErrorMessage()}\n"; throw $caught; } }
  • API 세부 정보는 AWS SDK for PHP API 참조DeleteVpcEndpoints를 참조하세요.

Python
SDK for Python (Boto3)
참고

GitHub에 더 많은 내용이 있습니다. AWS 코드 예시 리포지토리에서 전체 예시를 찾고 설정 및 실행하는 방법을 배워보세요.

class VpcWrapper: """Encapsulates Amazon Elastic Compute Cloud (Amazon EC2) Amazon Virtual Private Cloud actions.""" def __init__(self, ec2_client: boto3.client): """ Initializes the VpcWrapper with an EC2 client. :param ec2_client: A Boto3 Amazon EC2 client. This client provides low-level access to AWS EC2 services. """ self.ec2_client = ec2_client @classmethod def from_client(cls) -> "VpcWrapper": """ Creates a VpcWrapper instance with a default EC2 client. :return: An instance of VpcWrapper initialized with the default EC2 client. """ ec2_client = boto3.client("ec2") return cls(ec2_client) def delete_vpc_endpoints(self, vpc_endpoint_ids: list[str]) -> None: """ Deletes the specified VPC endpoints. :param vpc_endpoint_ids: A list of IDs of the VPC endpoints to delete. """ try: self.ec2_client.delete_vpc_endpoints(VpcEndpointIds=vpc_endpoint_ids) except ClientError as err: logger.error( "Couldn't delete VPC endpoints %s. Here's why: %s: %s", vpc_endpoint_ids, err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise
  • API 세부 정보는 AWS SDK for Python (Boto3) API 참조DeleteVpcEndpoints를 참조하세요.

AWS SDK 개발자 안내서 및 코드 예제의 전체 목록은 섹션을 참조하세요를 사용하여 Amazon EC2 리소스 생성 AWS SDK. 이 주제에는 시작하기에 대한 정보와 이전 SDK 버전에 대한 세부 정보도 포함되어 있습니다.