This CloudFormation template creates a security group that allows inbound access to a Postgresql instance. It allows connections on port 5432 and is open to all IP addresses.

CloudFormation Template