def create_vpce_service()

in python/vpce/create_vpce_service_configuration_sample.py [0:0]


def create_vpce_service(gwlb_arns, acceptance=True):
    """
    Creates VPC Endpoint Service.

    Accepts:
    - gwlb_arns : ['gwlb1_arn']
    - acceptance (bool): True|False. Default is True

    Usage:
    - create_vpce_service(['gwlb1_arn'], True)
    """
    logging.info("Creating VPC Endpoint Service:")
    try:
        response = ec2.create_vpc_endpoint_service_configuration(
            AcceptanceRequired=acceptance,
            GatewayLoadBalancerArns=gwlb_arns,
        )
        service_id = response['ServiceConfiguration']['ServiceId']
        service_name = response['ServiceConfiguration']['ServiceName']
        return response, service_id, service_name
    except ClientError as e:
        logging.error(e)
        return None