AWS Amazon RDS Security Group

This page shows how to write Terraform and CloudFormation for Amazon RDS Security Group and write them securely.

aws_db_security_group (Terraform)

The Security Group in Amazon RDS can be configured in Terraform with the resource name aws_db_security_group. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

github-iconstorebot/pr_demo_flat
resource "aws_db_security_group" "rdsHostsHigherThan256" {
  name = "rds_sg"

  ingress {
    cidr = "192.164.0.0/23"
  }
github-iconpatilpankaj212/terrascan-policies
resource "aws_db_security_group" "rdsHostsHigherThan256" {
  name = "rds_sg"

  ingress {
    cidr = "192.164.0.0/23"
  }
github-iconpatilpankaj212/terrascan-policies
resource "aws_db_security_group" "rdsHostsHigherThan256" {
  name = "rds_sg"

  ingress {
    cidr = "10.164.0.0/32"
  }
github-iconaccurics/policies
resource "aws_db_security_group" "rdsHostsHigherThan256" {
  name = "rds_sg"

  ingress {
    cidr = "192.164.0.0/23"
  }
github-iconaccurics/policies
resource "aws_db_security_group" "rdsHostsHigherThan256" {
  name = "rds_sg"

  ingress {
    cidr = "10.164.0.0/32"
  }

Parameters

Explanation in Terraform Registry

Provides an RDS security group resource. This is only for DB instances in the EC2-Classic Platform. For instances inside a VPC, use the aws_db_instance.vpc_security_group_ids attribute instead.

AWS::RDS::DBSecurityGroup (CloudFormation)

The DBSecurityGroup in RDS can be configured in CloudFormation with the resource name AWS::RDS::DBSecurityGroup. The following sections describe how to use the resource and its parameters.

Parameters

Explanation in CloudFormation Registry

The AWS::RDS::DBSecurityGroup resource creates or updates an Amazon RDS DB security group.

Note DB security groups are a part of the EC2-Classic Platform and as such are not supported in all regions. It is advised to use the AWS::EC2::SecurityGroup resource in those regions instead. To determine which platform you are on, see Determining Whether You Are Using the EC2-VPC or EC2-Classic Platform. For more information on the AWS::EC2::SecurityGroup, see the documentation for EC2 security groups.

Frequently asked questions

What is AWS Amazon RDS Security Group?

AWS Amazon RDS Security Group is a resource for Amazon RDS of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon RDS Security Group?

For Terraform, the storebot/pr_demo_flat, patilpankaj212/terrascan-policies and patilpankaj212/terrascan-policies source code examples are useful. See the Terraform Example section for further details.