Control: Lambda functions should operate in more than one availability zone
Description
This control checks if Lambda has more than one availability zone associated. The rule fails if only one availability zone is associated with Lambda.
Usage
Run the control in your terminal:
powerpipe control run aws_compliance.control.lambda_function_multiple_az_configuredSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run aws_compliance.control.lambda_function_multiple_az_configured --shareSQL
This control uses a named query:
select  arn as resource,  case    when vpc_id is null or vpc_id = '' then 'skip'    else case      when      (        select          count(distinct availability_zone_id)        from          aws_vpc_subnet        where          subnet_id in (select jsonb_array_elements_text(vpc_subnet_ids) )      ) >= 2      then 'ok'      else 'alarm'    end  end as status,  case    when vpc_id is null or vpc_id = '' then title || ' is not in VPC.'    else title || ' has ' || jsonb_array_length(vpc_subnet_ids) || ' availability zone(s).'  end as reason    , region, account_idfrom  aws_lambda_function;