def lambda_handler()

in workflow2_docsplitter/sam-app/functions/getalbinfo_function/index.py [0:0]


def lambda_handler(event, context):
    ec2 = boto3.client('ec2')
    vpc_response = ec2.describe_vpcs(
        Filters=[
            {
                'Name': 'is-default',
                'Values': [
                    'true'
                ]
            }
        ]
    )
    vpc_id = vpc_response['Vpcs'][0]['VpcId']

    subnet_response = ec2.describe_subnets(
        Filters=[
            {
                'Name': 'vpc-id',
                'Values': [
                    vpc_id
                ]
            }
        ]
    )
    subnet_ids = [subnet['SubnetId'] for subnet in subnet_response['Subnets']]

    response_data = {
        'VpcId': vpc_id,
        'Subnets': subnet_ids
    }

    return send(event, context, "SUCCESS", response_data)