in python/vpce/create_gwlb_endpoint_sample.py [0:0]
def create_gwlbe(service_name, vpc_id, subnet_ids):
"""
Creates VPC Endpoint Service.
Accepts:
- service_name (str): VPCE Service name.
- vpc_id : 'vpc-xxxx'
- subnet_ids (list of str): ['subnet-xxxx'], only one subnet id for GWLBe
Usage:
- create_gwlbe('service_name', 'vpc-xxxx', ['subnet-xxxx']
"""
logging.info("Creating VPC Endpoint of Type GatewayLoadBalancer:")
try:
response = ec2.create_vpc_endpoint(
VpcEndpointType='GatewayLoadBalancer',
VpcId=vpc_id,
SubnetIds=subnet_ids,
ServiceName=service_name
)
vpce_id = response['VpcEndpoint']['VpcEndpointId']
vpce_id_type = response['VpcEndpoint']['VpcEndpointType']
return response, vpce_id, vpce_id_type
except ClientError as e:
logging.error(e)
return None