Tuesday, 4 October 2016

Create VPN connection using python boto API


                                          Create VPN connection using python boto API

#!/usr/bin/env python2

import boto.vpc
import boto.ec2
import time
#boto.set_stream_logger('boto')

#Connect with AWS region

REGION_NAME = 'ap-southeast-1'

#Connect with your Region
conn = boto.vpc.connect_to_region(REGION_NAME)

#Define your VPC

vpc = 'vpc-a6587c3'

#Create Customer Gateway VPN: ipsec vpn tunnel,Customer Gateway IP,BGP ASN NO,for static please specify BGP ASN=65000 ,Else get the BGP ASN NO. from Customer

cg = conn.create_customer_gateway('ipsec.1', '106.51.254.158', 65534)
print cg.id

#Create Virtual Private

vg = conn.create_vpn_gateway('ipsec.1')
print vg.id

#Attaching VPN Gateway with the VPC

vggateway = vg.attach(vpc)

a = type(vggateway)
print a
print vggateway

# Create VPN connection
vpn = conn.create_vpn_connection('ipsec.1',cg.id,vg.id )
#print vpn

3 comments:

  1. Gratitude for sharing the info about VPN connection using python boto API. Keep sharing such posts. I also have to find out the best vpn china for my China trip. Mainly need a service that can help unblock social media and video sites. Do you think NordVPN is a good choice?

    ReplyDelete
  2. Moreover, most of the service providers do not track the activity of premium account members while they generally keep a log of free members. benefit of VPN

    ReplyDelete
  3. Ivacy VPN has been rated #1 in fastest vpn list by bestvpn.com-The most reputable VPN reviewer in the industry.
    Browse securely and enjoy fast vpn connection anywhere, anytime. Ivacy VPN offers 450+ Servers in 100+ Locations.
    Ivacy is built for High-Speed VPN connection so that you can enjoy seamless Online Streaming, Unlimited Bandwidth, and a Secure Web-surfing experience.

    ReplyDelete