ProxyTarget

class aws_cdk.aws_rds.ProxyTarget(*args: Any, **kwargs)

Bases: object

Proxy target: Instance or Cluster.

A target group is a collection of databases that the proxy can connect to. Currently, you can specify only one RDS DB instance or Aurora DB cluster.

Example:

# vpc is of type Vpc

cluster = rds.DatabaseCluster(self, "Database",
    engine=rds.DatabaseClusterEngine.AURORA,
    instance_props=rds.InstanceProps(vpc=vpc)
)

proxy = rds.DatabaseProxy(self, "Proxy",
    proxy_target=rds.ProxyTarget.from_cluster(cluster),
    secrets=[cluster.secret],
    vpc=vpc
)

role = iam.Role(self, "DBProxyRole", assumed_by=iam.AccountPrincipal(self.account))
proxy.grant_connect(role, "admin")

Methods

bind(proxy)

Bind this target to the specified database proxy.

Parameters

proxy (DatabaseProxy) –

Return type

ProxyTargetConfig

Static Methods

classmethod from_cluster(cluster)

From cluster.

Parameters

cluster (IDatabaseCluster) – RDS database cluster.

Return type

ProxyTarget

classmethod from_instance(instance)

From instance.

Parameters

instance (IDatabaseInstance) – RDS database instance.

Return type

ProxyTarget