OptionGroup
- class aws_cdk.aws_rds.OptionGroup(scope, id, *, configurations, engine, description=None)
Bases:
Resource
An option group.
- ExampleMetadata:
lit=test/integ.instance.lit.ts infused
Example:
# Set open cursors with parameter group parameter_group = rds.ParameterGroup(self, "ParameterGroup", engine=rds.DatabaseInstanceEngine.oracle_se2(version=rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1), parameters={ "open_cursors": "2500" } ) option_group = rds.OptionGroup(self, "OptionGroup", engine=rds.DatabaseInstanceEngine.oracle_se2(version=rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1), configurations=[rds.OptionConfiguration( name="LOCATOR" ), rds.OptionConfiguration( name="OEM", port=1158, vpc=vpc ) ] ) # Allow connections to OEM option_group.option_connections.OEM.connections.allow_default_port_from_any_ipv4() # Database instance with production values instance = rds.DatabaseInstance(self, "Instance", engine=rds.DatabaseInstanceEngine.oracle_se2(version=rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1), license_model=rds.LicenseModel.BRING_YOUR_OWN_LICENSE, instance_type=ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM), multi_az=True, storage_type=rds.StorageType.IO1, credentials=rds.Credentials.from_username("syscdk"), vpc=vpc, database_name="ORCL", storage_encrypted=True, backup_retention=cdk.Duration.days(7), monitoring_interval=cdk.Duration.seconds(60), enable_performance_insights=True, cloudwatch_logs_exports=["trace", "audit", "alert", "listener" ], cloudwatch_logs_retention=logs.RetentionDays.ONE_MONTH, auto_minor_version_upgrade=True, # required to be true if LOCATOR is used in the option group option_group=option_group, parameter_group=parameter_group, removal_policy=RemovalPolicy.DESTROY ) # Allow connections on default port from any IPV4 instance.connections.allow_default_port_from_any_ipv4() # Rotate the master user password every 30 days instance.add_rotation_single_user() # Add alarm for high CPU cloudwatch.Alarm(self, "HighCPU", metric=instance.metric_cPUUtilization(), threshold=90, evaluation_periods=1 ) # Trigger Lambda function on instance availability events fn = lambda_.Function(self, "Function", code=lambda_.Code.from_inline("exports.handler = (event) => console.log(event);"), handler="index.handler", runtime=lambda_.Runtime.NODEJS_14_X ) availability_rule = instance.on_event("Availability", target=targets.LambdaFunction(fn)) availability_rule.add_event_pattern( detail={ "EventCategories": ["availability" ] } )
- Parameters:
scope (
Construct
)id (
str
)configurations (
Sequence
[Union
[OptionConfiguration
,Dict
[str
,Any
]]]) – The configurations for this option group.engine (
IInstanceEngine
) – The database engine that this option group is associated with.description (
Optional
[str
]) – A description of the option group. Default: a CDK generated description
Methods
- add_configuration(*, name, port=None, security_groups=None, settings=None, version=None, vpc=None)
Adds a configuration to this OptionGroup.
This method is a no-op for an imported OptionGroup.
- Parameters:
name (
str
) – The name of the option.port (
Union
[int
,float
,None
]) – The port number that this option uses. Ifport
is specified thenvpc
must also be specified. Default: - no portsecurity_groups (
Optional
[Sequence
[ISecurityGroup
]]) – Optional list of security groups to use for this option, ifvpc
is specified. If no groups are provided, a default one will be created. Default: - a default group will be created ifport
orvpc
are specified.settings (
Optional
[Mapping
[str
,str
]]) – The settings for the option. Default: - no settingsversion (
Optional
[str
]) – The version for the option. Default: - no versionvpc (
Optional
[IVpc
]) – The VPC where a security group should be created for this option. Ifvpc
is specified thenport
must also be specified. Default: - no VPC
- Return type:
bool
- apply_removal_policy(policy)
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
).- Parameters:
policy (
RemovalPolicy
)- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- env
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
The construct tree node associated with this construct.
- option_connections
The connections object for the options.
- option_group_name
The name of the option group.
- stack
The stack in which this resource is defined.
Static Methods
- classmethod from_option_group_name(scope, id, option_group_name)
Import an existing option group.
- Parameters:
scope (
Construct
)id (
str
)option_group_name (
str
)
- Return type:
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
)- Return type:
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters:
construct (
IConstruct
)- Return type:
bool