published on Tuesday, Mar 10, 2026 by Pulumi
published on Tuesday, Mar 10, 2026 by Pulumi
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.
!> WARNING: With the retirement of EC2-Classic the aws.rds.SecurityGroup resource has been deprecated and will be removed in a future version.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var @default = new Aws.Rds.SecurityGroup("default", new()
{
Ingress = new[]
{
new Aws.Rds.Inputs.SecurityGroupIngressArgs
{
Cidr = "10.0.0.0/24",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/rds"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := rds.NewSecurityGroup(ctx, "default", &rds.SecurityGroupArgs{
Ingress: rds.SecurityGroupIngressArray{
&rds.SecurityGroupIngressArgs{
Cidr: pulumi.String("10.0.0.0/24"),
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.rds.SecurityGroup;
import com.pulumi.aws.rds.SecurityGroupArgs;
import com.pulumi.aws.rds.inputs.SecurityGroupIngressArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var default_ = new SecurityGroup("default", SecurityGroupArgs.builder()
.ingress(SecurityGroupIngressArgs.builder()
.cidr("10.0.0.0/24")
.build())
.build());
}
}
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const _default = new aws.rds.SecurityGroup("default", {ingress: [{
cidr: "10.0.0.0/24",
}]});
import pulumi
import pulumi_aws as aws
default = aws.rds.SecurityGroup("default", ingress=[aws.rds.SecurityGroupIngressArgs(
cidr="10.0.0.0/24",
)])
resources:
default:
type: aws:rds:SecurityGroup
properties:
ingress:
- cidr: 10.0.0.0/24
Create SecurityGroup Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new SecurityGroup(name: string, args: SecurityGroupArgs, opts?: CustomResourceOptions);@overload
def SecurityGroup(resource_name: str,
args: SecurityGroupArgs,
opts: Optional[ResourceOptions] = None)
@overload
def SecurityGroup(resource_name: str,
opts: Optional[ResourceOptions] = None,
ingress: Optional[Sequence[SecurityGroupIngressArgs]] = None,
description: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None)func NewSecurityGroup(ctx *Context, name string, args SecurityGroupArgs, opts ...ResourceOption) (*SecurityGroup, error)public SecurityGroup(string name, SecurityGroupArgs args, CustomResourceOptions? opts = null)
public SecurityGroup(String name, SecurityGroupArgs args)
public SecurityGroup(String name, SecurityGroupArgs args, CustomResourceOptions options)
type: aws:rds:SecurityGroup
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args SecurityGroupArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args SecurityGroupArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SecurityGroupArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SecurityGroupArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SecurityGroupArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var examplesecurityGroupResourceResourceFromRdssecurityGroup = new Aws.Rds.SecurityGroup("examplesecurityGroupResourceResourceFromRdssecurityGroup", new()
{
Ingress = new[]
{
new Aws.Rds.Inputs.SecurityGroupIngressArgs
{
Cidr = "string",
SecurityGroupId = "string",
SecurityGroupName = "string",
SecurityGroupOwnerId = "string",
},
},
Description = "string",
Name = "string",
Tags =
{
{ "string", "string" },
},
});
example, err := rds.NewSecurityGroup(ctx, "examplesecurityGroupResourceResourceFromRdssecurityGroup", &rds.SecurityGroupArgs{
Ingress: rds.SecurityGroupIngressArray{
&rds.SecurityGroupIngressArgs{
Cidr: pulumi.String("string"),
SecurityGroupId: pulumi.String("string"),
SecurityGroupName: pulumi.String("string"),
SecurityGroupOwnerId: pulumi.String("string"),
},
},
Description: pulumi.String("string"),
Name: pulumi.String("string"),
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var examplesecurityGroupResourceResourceFromRdssecurityGroup = new com.pulumi.aws.rds.SecurityGroup("examplesecurityGroupResourceResourceFromRdssecurityGroup", com.pulumi.aws.rds.SecurityGroupArgs.builder()
.ingress(SecurityGroupIngressArgs.builder()
.cidr("string")
.securityGroupId("string")
.securityGroupName("string")
.securityGroupOwnerId("string")
.build())
.description("string")
.name("string")
.tags(Map.of("string", "string"))
.build());
examplesecurity_group_resource_resource_from_rdssecurity_group = aws.rds.SecurityGroup("examplesecurityGroupResourceResourceFromRdssecurityGroup",
ingress=[{
"cidr": "string",
"security_group_id": "string",
"security_group_name": "string",
"security_group_owner_id": "string",
}],
description="string",
name="string",
tags={
"string": "string",
})
const examplesecurityGroupResourceResourceFromRdssecurityGroup = new aws.rds.SecurityGroup("examplesecurityGroupResourceResourceFromRdssecurityGroup", {
ingress: [{
cidr: "string",
securityGroupId: "string",
securityGroupName: "string",
securityGroupOwnerId: "string",
}],
description: "string",
name: "string",
tags: {
string: "string",
},
});
type: aws:rds:SecurityGroup
properties:
description: string
ingress:
- cidr: string
securityGroupId: string
securityGroupName: string
securityGroupOwnerId: string
name: string
tags:
string: string
SecurityGroup Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The SecurityGroup resource accepts the following input properties:
- Ingress
List<Security
Group Ingress> - A list of ingress rules.
- Description string
- The description of the DB security group. Defaults to "Managed by Pulumi".
- Name string
- The name of the DB security group.
- Dictionary<string, string>
- A map of tags to assign to the resource. .If configured with a provider
default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- Ingress
[]Security
Group Ingress Args - A list of ingress rules.
- Description string
- The description of the DB security group. Defaults to "Managed by Pulumi".
- Name string
- The name of the DB security group.
- map[string]string
- A map of tags to assign to the resource. .If configured with a provider
default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- ingress
List<Security
Group Ingress> - A list of ingress rules.
- description String
- The description of the DB security group. Defaults to "Managed by Pulumi".
- name String
- The name of the DB security group.
- Map<String,String>
- A map of tags to assign to the resource. .If configured with a provider
default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- ingress
Security
Group Ingress[] - A list of ingress rules.
- description string
- The description of the DB security group. Defaults to "Managed by Pulumi".
- name string
- The name of the DB security group.
- {[key: string]: string}
- A map of tags to assign to the resource. .If configured with a provider
default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- ingress
Sequence[Security
Group Ingress Args] - A list of ingress rules.
- description str
- The description of the DB security group. Defaults to "Managed by Pulumi".
- name str
- The name of the DB security group.
- Mapping[str, str]
- A map of tags to assign to the resource. .If configured with a provider
default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- ingress List<Property Map>
- A list of ingress rules.
- description String
- The description of the DB security group. Defaults to "Managed by Pulumi".
- name String
- The name of the DB security group.
- Map<String>
- A map of tags to assign to the resource. .If configured with a provider
default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
Outputs
All input properties are implicitly available as output properties. Additionally, the SecurityGroup resource produces the following output properties:
Look up Existing SecurityGroup Resource
Get an existing SecurityGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: SecurityGroupState, opts?: CustomResourceOptions): SecurityGroup@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
arn: Optional[str] = None,
description: Optional[str] = None,
ingress: Optional[Sequence[SecurityGroupIngressArgs]] = None,
name: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
tags_all: Optional[Mapping[str, str]] = None) -> SecurityGroupfunc GetSecurityGroup(ctx *Context, name string, id IDInput, state *SecurityGroupState, opts ...ResourceOption) (*SecurityGroup, error)public static SecurityGroup Get(string name, Input<string> id, SecurityGroupState? state, CustomResourceOptions? opts = null)public static SecurityGroup get(String name, Output<String> id, SecurityGroupState state, CustomResourceOptions options)resources: _: type: aws:rds:SecurityGroup get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Arn string
- The arn of the DB security group.
- Description string
- The description of the DB security group. Defaults to "Managed by Pulumi".
- Ingress
List<Security
Group Ingress> - A list of ingress rules.
- Name string
- The name of the DB security group.
- Dictionary<string, string>
- A map of tags to assign to the resource. .If configured with a provider
default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level. - Dictionary<string, string>
- A map of tags assigned to the resource, including those inherited from the provider
default_tagsconfiguration block.
- Arn string
- The arn of the DB security group.
- Description string
- The description of the DB security group. Defaults to "Managed by Pulumi".
- Ingress
[]Security
Group Ingress Args - A list of ingress rules.
- Name string
- The name of the DB security group.
- map[string]string
- A map of tags to assign to the resource. .If configured with a provider
default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level. - map[string]string
- A map of tags assigned to the resource, including those inherited from the provider
default_tagsconfiguration block.
- arn String
- The arn of the DB security group.
- description String
- The description of the DB security group. Defaults to "Managed by Pulumi".
- ingress
List<Security
Group Ingress> - A list of ingress rules.
- name String
- The name of the DB security group.
- Map<String,String>
- A map of tags to assign to the resource. .If configured with a provider
default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level. - Map<String,String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tagsconfiguration block.
- arn string
- The arn of the DB security group.
- description string
- The description of the DB security group. Defaults to "Managed by Pulumi".
- ingress
Security
Group Ingress[] - A list of ingress rules.
- name string
- The name of the DB security group.
- {[key: string]: string}
- A map of tags to assign to the resource. .If configured with a provider
default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level. - {[key: string]: string}
- A map of tags assigned to the resource, including those inherited from the provider
default_tagsconfiguration block.
- arn str
- The arn of the DB security group.
- description str
- The description of the DB security group. Defaults to "Managed by Pulumi".
- ingress
Sequence[Security
Group Ingress Args] - A list of ingress rules.
- name str
- The name of the DB security group.
- Mapping[str, str]
- A map of tags to assign to the resource. .If configured with a provider
default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level. - Mapping[str, str]
- A map of tags assigned to the resource, including those inherited from the provider
default_tagsconfiguration block.
- arn String
- The arn of the DB security group.
- description String
- The description of the DB security group. Defaults to "Managed by Pulumi".
- ingress List<Property Map>
- A list of ingress rules.
- name String
- The name of the DB security group.
- Map<String>
- A map of tags to assign to the resource. .If configured with a provider
default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level. - Map<String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tagsconfiguration block.
Supporting Types
SecurityGroupIngress, SecurityGroupIngressArgs
- Cidr string
- The CIDR block to accept
- Security
Group stringId - The ID of the security group to authorize
- Security
Group stringName - The name of the security group to authorize
- Security
Group stringOwner Id - The owner Id of the security group provided
by
security_group_name.
- Cidr string
- The CIDR block to accept
- Security
Group stringId - The ID of the security group to authorize
- Security
Group stringName - The name of the security group to authorize
- Security
Group stringOwner Id - The owner Id of the security group provided
by
security_group_name.
- cidr String
- The CIDR block to accept
- security
Group StringId - The ID of the security group to authorize
- security
Group StringName - The name of the security group to authorize
- security
Group StringOwner Id - The owner Id of the security group provided
by
security_group_name.
- cidr string
- The CIDR block to accept
- security
Group stringId - The ID of the security group to authorize
- security
Group stringName - The name of the security group to authorize
- security
Group stringOwner Id - The owner Id of the security group provided
by
security_group_name.
- cidr str
- The CIDR block to accept
- security_
group_ strid - The ID of the security group to authorize
- security_
group_ strname - The name of the security group to authorize
- security_
group_ strowner_ id - The owner Id of the security group provided
by
security_group_name.
- cidr String
- The CIDR block to accept
- security
Group StringId - The ID of the security group to authorize
- security
Group StringName - The name of the security group to authorize
- security
Group StringOwner Id - The owner Id of the security group provided
by
security_group_name.
Import
DB Security groups can be imported using the name, e.g.,
$ pulumi import aws:rds/securityGroup:SecurityGroup default aws_rds_sg-1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
published on Tuesday, Mar 10, 2026 by Pulumi