class ProxyTarget
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.RDS.ProxyTarget |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsrds#ProxyTarget |
![]() | software.amazon.awscdk.services.rds.ProxyTarget |
![]() | aws_cdk.aws_rds.ProxyTarget |
![]() | aws-cdk-lib » aws_rds » ProxyTarget |
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
declare const vpc: ec2.Vpc;
const cluster = new rds.DatabaseCluster(this, 'Database', {
engine: rds.DatabaseClusterEngine.auroraMysql({
version: rds.AuroraMysqlEngineVersion.VER_3_03_0,
}),
writer: rds.ClusterInstance.provisioned('writer'),
vpc,
});
const proxy = new rds.DatabaseProxy(this, 'Proxy', {
proxyTarget: rds.ProxyTarget.fromCluster(cluster),
secrets: [cluster.secret!],
vpc,
});
const role = new iam.Role(this, 'DBProxyRole', { assumedBy: new iam.AccountPrincipal(this.account) });
proxy.grantConnect(role, 'admin'); // Grant the role connection access to the DB Proxy for database user 'admin'.
Methods
Name | Description |
---|---|
bind(proxy) | Bind this target to the specified database proxy. |
static from | From cluster. |
static from | From instance. |
bind(proxy)
public bind(proxy: DatabaseProxy): ProxyTargetConfig
Parameters
- proxy
Database
Proxy
Returns
Bind this target to the specified database proxy.
static fromCluster(cluster)
public static fromCluster(cluster: IDatabaseCluster): ProxyTarget
Parameters
- cluster
IDatabase
— RDS database cluster.Cluster
Returns
From cluster.
static fromInstance(instance)
public static fromInstance(instance: IDatabaseInstance): ProxyTarget
Parameters
- instance
IDatabase
— RDS database instance.Instance
Returns
From instance.