aws-cdk-lib.aws_rds.ParameterGroup

class ParameterGroup (construct)

LanguageType name
.NETAmazon.CDK.AWS.RDS.ParameterGroup
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsrds#ParameterGroup
Javasoftware.amazon.awscdk.services.rds.ParameterGroup
Pythonaws_cdk.aws_rds.ParameterGroup
TypeScript (source)aws-cdk-lib » aws_rds » ParameterGroup

Implements IConstruct, IDependable, IResource, IParameterGroup

A parameter group.

Represents both a cluster parameter group, and an instance parameter group.

Example

declare const plan: backup.BackupPlan;
declare const vpc: ec2.Vpc;
const myTable = dynamodb.Table.fromTableName(this, 'Table', 'myTableName');
const myDatabaseInstance = new rds.DatabaseInstance(this, 'DatabaseInstance', {
  engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_26 }),
  vpc,
});
const myDatabaseCluster = new rds.DatabaseCluster(this, 'DatabaseCluster', {
  engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_08_1 }),
  credentials: rds.Credentials.fromGeneratedSecret('clusteradmin'),
  instanceProps: {
    vpc,
  },
});
const myServerlessCluster = new rds.ServerlessCluster(this, 'ServerlessCluster', {
  engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL,
  parameterGroup: rds.ParameterGroup.fromParameterGroupName(this, 'ParameterGroup', 'default.aurora-postgresql10'),
  vpc,
});
const myCoolConstruct = new Construct(this, 'MyCoolConstruct');

plan.addSelection('Selection', {
  resources: [
    backup.BackupResource.fromDynamoDbTable(myTable), // A DynamoDB table
    backup.BackupResource.fromRdsDatabaseInstance(myDatabaseInstance), // A RDS instance
    backup.BackupResource.fromRdsDatabaseCluster(myDatabaseCluster), // A RDS database cluster
    backup.BackupResource.fromRdsServerlessCluster(myServerlessCluster), // An Aurora Serverless cluster
    backup.BackupResource.fromTag('stage', 'prod'), // All resources that are tagged stage=prod in the region/account
    backup.BackupResource.fromConstruct(myCoolConstruct), // All backupable resources in `myCoolConstruct`
  ]
})

Initializer

new ParameterGroup(scope: Construct, id: string, props: ParameterGroupProps)

Parameters

  • scope Construct
  • id string
  • props ParameterGroupProps

Construct Props

NameTypeDescription
engineIEngineThe database engine for this parameter group.
description?stringDescription for this parameter group.
parameters?{ [string]: string }The parameters in this parameter group.

engine

Type: IEngine

The database engine for this parameter group.


description?

Type: string (optional, default: a CDK generated description)

Description for this parameter group.


parameters?

Type: { [string]: string } (optional, default: None)

The parameters in this parameter group.

Properties

NameTypeDescription
envResourceEnvironmentThe environment this resource belongs to.
nodeNodeThe tree node.
stackStackThe stack in which this resource is defined.

env

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


node

Type: Node

The tree node.


stack

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
addParameter(key, value)Add a parameter to this parameter group.
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
bindToCluster(_options)Method called when this Parameter Group is used when defining a database cluster.
bindToInstance(_options)Method called when this Parameter Group is used when defining a database instance.
toString()Returns a string representation of this construct.
static fromParameterGroupName(scope, id, parameterGroupName)Imports a parameter group.

addParameter(key, value)

public addParameter(key: string, value: string): boolean

Parameters

  • key string — The key of the parameter to be added.
  • value string — The value of the parameter to be added.

Returns

  • boolean

Add a parameter to this parameter group.


applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

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)

public bindToCluster(_options: ParameterGroupClusterBindOptions): ParameterGroupClusterConfig

Parameters

  • _options ParameterGroupClusterBindOptions

Returns

  • ParameterGroupClusterConfig

Method called when this Parameter Group is used when defining a database cluster.


bindToInstance(_options)

public bindToInstance(_options: ParameterGroupInstanceBindOptions): ParameterGroupInstanceConfig

Parameters

  • _options ParameterGroupInstanceBindOptions

Returns

  • ParameterGroupInstanceConfig

Method called when this Parameter Group is used when defining a database instance.


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromParameterGroupName(scope, id, parameterGroupName)

public static fromParameterGroupName(scope: Construct, id: string, parameterGroupName: string): IParameterGroup

Parameters

  • scope Construct
  • id string
  • parameterGroupName string

Returns

  • IParameterGroup

Imports a parameter group.