本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
搭配使用 AttachVpnGateway 與 CLI
下列程式碼範例示範如何使用 AttachVpnGateway。
- CLI
- 
            - AWS CLI
- 
             
                    將虛擬私有閘道連接至 VPC 下列 attach-vpn-gateway範例會將指定的虛擬私有閘道連接至指定的 VPC。aws ec2 attach-vpn-gateway \ --vpn-gateway-idvgw-9a4cacf3\ --vpc-idvpc-a01106c2輸出: { "VpcAttachment": { "State": "attaching", "VpcId": "vpc-a01106c2" } }- 
                    如需 API 詳細資訊,請參閱《 AWS CLI 命令參考》中的 AttachVpnGateway 。 
 
- 
                    
 
- PowerShell
- 
            - PowerShell V4 的工具
- 
             
                    範例 1:此範例會將指定的虛擬私有閘道連接到指定的 VPC。 Add-EC2VpnGateway -VpnGatewayId vgw-1a2b3c4d -VpcId vpc-12345678輸出: State VpcId ----- ----- attaching vpc-12345678- 
                    如需 API 詳細資訊,請參閱AWS Tools for PowerShell 《 Cmdlet Reference (V4)》中的 AttachVpnGateway。 
 
- 
                    
- PowerShell V5 的工具
- 
             
                    範例 1:此範例會將指定的虛擬私有閘道連接至指定的 VPC。 Add-EC2VpnGateway -VpnGatewayId vgw-1a2b3c4d -VpcId vpc-12345678輸出: State VpcId ----- ----- attaching vpc-12345678- 
                    如需 API 詳細資訊,請參閱AWS Tools for PowerShell 《 Cmdlet Reference (V5)》中的 AttachVpnGateway。 
 
- 
                    
 
如需 AWS SDK 開發人員指南和程式碼範例的完整清單,請參閱 使用 SDK 建立 Amazon EC2 資源 AWS。此主題也包含有關入門的資訊和舊版 SDK 的詳細資訊。
AttachVolume
AuthorizeSecurityGroupEgress