Skip to content
v2.274.0

ParameterGroup L2 construct ​

A parameter group.

Represents both a cluster parameter group (AWS::RDS::DBClusterParameterGroup), and an instance parameter group (AWS::RDS::DBParameterGroup).

Example ​

ts
declare const vpc: ec2.Vpc;

const cluster = new rds.ServerlessCluster(this, 'AnotherCluster', {
  engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL,
  copyTagsToSnapshot: true, // whether to save the cluster tags when creating the snapshot. Default is 'true'
  parameterGroup: rds.ParameterGroup.fromParameterGroupName(this, 'ParameterGroup', 'default.aurora-postgresql11'),
  vpc,
  scaling: {
    autoPause: Duration.minutes(10), // default is to pause after 5 minutes of idle time
    minCapacity: rds.AuroraCapacityUnit.ACU_8, // default is 2 Aurora capacity units (ACUs)
    maxCapacity: rds.AuroraCapacityUnit.ACU_32, // default is 16 Aurora capacity units (ACUs)
    timeout: Duration.seconds(100), // default is 5 minutes
    timeoutAction: rds.TimeoutAction.FORCE_APPLY_CAPACITY_CHANGE // default is ROLLBACK_CAPACITY_CHANGE
  }
});
python
# vpc: ec2.Vpc


cluster = rds.ServerlessCluster(self, "AnotherCluster",
    engine=rds.DatabaseClusterEngine.AURORA_POSTGRESQL,
    copy_tags_to_snapshot=True,  # whether to save the cluster tags when creating the snapshot. Default is 'true'
    parameter_group=rds.ParameterGroup.from_parameter_group_name(self, "ParameterGroup", "default.aurora-postgresql11"),
    vpc=vpc,
    scaling=rds.ServerlessScalingOptions(
        auto_pause=Duration.minutes(10),  # default is to pause after 5 minutes of idle time
        min_capacity=rds.AuroraCapacityUnit.ACU_8,  # default is 2 Aurora capacity units (ACUs)
        max_capacity=rds.AuroraCapacityUnit.ACU_32,  # default is 16 Aurora capacity units (ACUs)
        timeout=Duration.seconds(100),  # default is 5 minutes
        timeout_action=rds.TimeoutAction.FORCE_APPLY_CAPACITY_CHANGE
    )
)
java
Vpc vpc;


ServerlessCluster cluster = ServerlessCluster.Builder.create(this, "AnotherCluster")
        .engine(DatabaseClusterEngine.AURORA_POSTGRESQL)
        .copyTagsToSnapshot(true) // whether to save the cluster tags when creating the snapshot. Default is 'true'
        .parameterGroup(ParameterGroup.fromParameterGroupName(this, "ParameterGroup", "default.aurora-postgresql11"))
        .vpc(vpc)
        .scaling(ServerlessScalingOptions.builder()
                .autoPause(Duration.minutes(10)) // default is to pause after 5 minutes of idle time
                .minCapacity(AuroraCapacityUnit.ACU_8) // default is 2 Aurora capacity units (ACUs)
                .maxCapacity(AuroraCapacityUnit.ACU_32) // default is 16 Aurora capacity units (ACUs)
                .timeout(Duration.seconds(100)) // default is 5 minutes
                .timeoutAction(TimeoutAction.FORCE_APPLY_CAPACITY_CHANGE)
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Vpc vpc;


var cluster = new ServerlessCluster(this, "AnotherCluster", new ServerlessClusterProps {
    Engine = DatabaseClusterEngine.AURORA_POSTGRESQL,
    CopyTagsToSnapshot = true,  // whether to save the cluster tags when creating the snapshot. Default is 'true'
    ParameterGroup = ParameterGroup.FromParameterGroupName(this, "ParameterGroup", "default.aurora-postgresql11"),
    Vpc = vpc,
    Scaling = new ServerlessScalingOptions {
        AutoPause = Duration.Minutes(10),  // default is to pause after 5 minutes of idle time
        MinCapacity = AuroraCapacityUnit.ACU_8,  // default is 2 Aurora capacity units (ACUs)
        MaxCapacity = AuroraCapacityUnit.ACU_32,  // default is 16 Aurora capacity units (ACUs)
        Timeout = Duration.Seconds(100),  // default is 5 minutes
        TimeoutAction = TimeoutAction.FORCE_APPLY_CAPACITY_CHANGE
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var vpc Vpc


cluster := rds.NewServerlessCluster(this, jsii.String("AnotherCluster"), &ServerlessClusterProps{
	Engine: rds.DatabaseClusterEngine_AURORA_POSTGRESQL(),
	CopyTagsToSnapshot: jsii.Boolean(true),
	 // whether to save the cluster tags when creating the snapshot. Default is 'true'
	ParameterGroup: rds.ParameterGroup_FromParameterGroupName(this, jsii.String("ParameterGroup"), jsii.String("default.aurora-postgresql11")),
	Vpc: Vpc,
	Scaling: &ServerlessScalingOptions{
		AutoPause: awscdk.Duration_Minutes(jsii.Number(10)),
		 // default is to pause after 5 minutes of idle time
		MinCapacity: rds.AuroraCapacityUnit_ACU_8,
		 // default is 2 Aurora capacity units (ACUs)
		MaxCapacity: rds.AuroraCapacityUnit_ACU_32,
		 // default is 16 Aurora capacity units (ACUs)
		Timeout: awscdk.Duration_Seconds(jsii.Number(100)),
		 // default is 5 minutes
		TimeoutAction: rds.TimeoutAction_FORCE_APPLY_CAPACITY_CHANGE,
	},
})

Initializer ​

ts
new ParameterGroup(scope: Construct, id: string, props: ParameterGroupProps)
python
ParameterGroup(scope: Construct, id: str, props: ParameterGroupProps)
java
new ParameterGroup(Construct scope, String id, ParameterGroupProps props)
csharp
new ParameterGroup(Construct scope, string id, ParameterGroupProps props)
go
NewParameterGroup(Scope Construct, Id *string, Props ParameterGroupProps)

Construct Props ​

descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string= a CDK generated description#
Description for this parameter group.
engineIEngineengineIEngineengineIEngineEngineIEngineEngineIEnginerequired#
The database engine for this parameter group.
namestringnamestrnameStringNamestringName*string= CloudFormation-generated name#
The name of this parameter group.
parameters{ [key: string]: string }parameterstyping.Mapping[str, str]parametersMap<String, String>ParametersIDictionary<string, string>Parameters*map[string]*string= None#
The parameters in this parameter group.
removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= RemovalPolicy.DESTROY#
The CloudFormation policy to apply when the instance is removed from the stack or replaced during an update.

Properties ​

dbClusterParameterGroupRefDBClusterParameterGroupReferencedb_cluster_parameter_group_refDBClusterParameterGroupReferencedbClusterParameterGroupRefDBClusterParameterGroupReferenceDbClusterParameterGroupRefDBClusterParameterGroupReferenceDbClusterParameterGroupRefDBClusterParameterGroupReferencerequired#
A reference to this parameter group as a DB cluster parameter group.
dbParameterGroupRefDBParameterGroupReferencedb_parameter_group_refDBParameterGroupReferencedbParameterGroupRefDBParameterGroupReferenceDbParameterGroupRefDBParameterGroupReferenceDbParameterGroupRefDBParameterGroupReferencerequired#
A reference to this parameter group as a DB parameter group.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#
Uniquely identifies this class.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.

Methods ​

addParameter(key: string, value: string): booleandef add_parameter(self, key: str, value: str) -> boolpublic Boolean addParameter(String key, String value)public bool AddParameter(string key, string value)func AddParameter(Key *string, Value *string) *bool#
Add a parameter to this parameter group.
2 parameters

Parameters

  • keykeykeykeyKey — The key of the parameter to be added.
  • valuevaluevaluevalueValue — The value of the parameter to be added.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

bindToCluster(_options: ParameterGroupClusterBindOptions): ParameterGroupClusterConfigdef bind_to_cluster(self, _options: ParameterGroupClusterBindOptions) -> ParameterGroupClusterConfigpublic ParameterGroupClusterConfig bindToCluster(ParameterGroupClusterBindOptions _options)public ParameterGroupClusterConfig BindToCluster(ParameterGroupClusterBindOptions _options)func BindToCluster(_options ParameterGroupClusterBindOptions) ParameterGroupClusterConfig#
Method called when this Parameter Group is used when defining a database cluster.
bindToInstance(_options: ParameterGroupInstanceBindOptions): ParameterGroupInstanceConfigdef bind_to_instance(self, _options: ParameterGroupInstanceBindOptions) -> ParameterGroupInstanceConfigpublic ParameterGroupInstanceConfig bindToInstance(ParameterGroupInstanceBindOptions _options)public ParameterGroupInstanceConfig BindToInstance(ParameterGroupInstanceBindOptions _options)func BindToInstance(_options ParameterGroupInstanceBindOptions) ParameterGroupInstanceConfig#
Method called when this Parameter Group is used when defining a database instance.
forCluster(scope: Construct, id: string, props: ParameterGroupProps): IParameterGroup@staticmethod def for_cluster(scope: Construct, id: str, props: ParameterGroupProps) -> IParameterGrouppublic static IParameterGroup forCluster(Construct scope, String id, ParameterGroupProps props)public static IParameterGroup ForCluster(Construct scope, string id, ParameterGroupProps props)func ForCluster(Scope Construct, Id *string, Props ParameterGroupProps) IParameterGroupstatic#
Creates a standalone cluster parameter group.

This method allows you to explicitly create a parameter group without binding it to a database cluster.

returns

Returns: cluster parameter group (AWS::RDS::DBClusterParameterGroup)

forInstance(scope: Construct, id: string, props: ParameterGroupProps): IParameterGroup@staticmethod def for_instance(scope: Construct, id: str, props: ParameterGroupProps) -> IParameterGrouppublic static IParameterGroup forInstance(Construct scope, String id, ParameterGroupProps props)public static IParameterGroup ForInstance(Construct scope, string id, ParameterGroupProps props)func ForInstance(Scope Construct, Id *string, Props ParameterGroupProps) IParameterGroupstatic#
Creates a standalone instance parameter group.

This method allows you to explicitly create a parameter group without binding it to a database instance.

returns

Returns: instance parameter group (AWS::RDS::DBParameterGroup)

fromParameterGroupName(scope: Construct, id: string, parameterGroupName: string): IParameterGroup@staticmethod def from_parameter_group_name(scope: Construct, id: str, parameter_group_name: str) -> IParameterGrouppublic static IParameterGroup fromParameterGroupName(Construct scope, String id, String parameterGroupName)public static IParameterGroup FromParameterGroupName(Construct scope, string id, string parameterGroupName)func FromParameterGroupName(Scope Construct, Id *string, ParameterGroupName *string) IParameterGroupstatic#
Imports a parameter group.

dbParameterGroupRef.dbParameterGroupArn is an instance DB parameter group ARN, and is not valid for a cluster parameter group.

isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.