CLI로 AttachVpnGateway 사용 - AWS SDK 코드 예제

AWS SDK 예제 GitHub 리포지토리에 더 많은 AWS문서 SDK 예제가 있습니다.

CLI로 AttachVpnGateway 사용

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

CLI
AWS CLI

VPC에 가상 프라이빗 게이트웨이 연결

다음 attach-vpn-gateway 예시에서는 지정된 가상 프라이빗 게이트웨이를 지정된 VPC에 연결합니다.

aws ec2 attach-vpn-gateway \ --vpn-gateway-id vgw-9a4cacf3 \ --vpc-id vpc-a01106c2

출력:

{ "VpcAttachment": { "State": "attaching", "VpcId": "vpc-a01106c2" } }
  • API 세부 정보는 AWS CLI 명령 참조AttachVpnGateway 섹션을 참조하세요.

PowerShell
Tools for PowerShell V4

예제 1: 이 예제에서는 지정된 가상 프라이빗 게이트웨이를 지정된 VPC에 연결합니다.

Add-EC2VpnGateway -VpnGatewayId vgw-1a2b3c4d -VpcId vpc-12345678

출력:

State VpcId ----- ----- attaching vpc-12345678
  • API 세부 정보는 AWS Tools for PowerShell Cmdlet 참조(V4)AttachVpnGateway를 참조하세요.

Tools for PowerShell V5

예제 1: 이 예제에서는 지정된 가상 프라이빗 게이트웨이를 지정된 VPC에 연결합니다.

Add-EC2VpnGateway -VpnGatewayId vgw-1a2b3c4d -VpcId vpc-12345678

출력:

State VpcId ----- ----- attaching vpc-12345678
  • API 세부 정보는 AWS Tools for PowerShell Cmdlet 참조(V5)AttachVpnGateway를 참조하세요.