turbot/aws_compliance

Query: rds_db_instance_and_cluster_no_default_port

Usage

powerpipe query aws_compliance.query.rds_db_instance_and_cluster_no_default_port

SQL

(
select
arn as resource,
case
when engine similar to '%(aurora|mysql|mariadb)%' and port = '3306' then 'alarm'
when engine like '%postgres%' and port = '5432' then 'alarm'
when engine like 'oracle%' and port = '1521' then 'alarm'
when engine like 'sqlserver%' and port = '1433' then 'alarm'
else 'ok'
end as status,
case
when engine similar to '%(aurora|mysql|mariadb)%' and port = '3306' then title || ' ' || engine || ' uses a default port.'
when engine like '%postgres%' and port = '5432' then title || ' ' || engine || ' uses a default port.'
when engine like 'oracle%' and port = '1521' then title || ' ' || engine || ' uses a default port.'
when engine like 'sqlserver%' and port = '1433' then title || ' ' || engine || ' uses a default port.'
else title || ' doesnt use a default port.'
end as reason
, region, account_id
from
aws_rds_db_cluster
)
union
(
select
arn as resource,
case
when engine similar to '%(aurora|mysql|mariadb)%' and port = '3306' then 'alarm'
when engine like '%postgres%' and port = '5432' then 'alarm'
when engine like 'oracle%' and port = '1521' then 'alarm'
when engine like 'sqlserver%' and port = '1433' then 'alarm'
else 'ok'
end as status,
case
when engine similar to '%(aurora|mysql|mariadb)%' and port = '3306' then title || ' ' || engine || ' uses a default port.'
when engine like '%postgres%' and port = '5432' then title || ' ' || engine || ' uses a default port.'
when engine like 'oracle%' and port = '1521' then title || ' ' || engine || ' uses a default port.'
when engine like 'sqlserver%' and port = '1433' then title || ' ' || engine || ' uses a default port.'
else title || ' doesnt use a default port.'
end as reason
, region, account_id
from
aws_rds_db_instance
);

Controls

The query is being used by the following controls: