class ProxyTarget
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.RDS.ProxyTarget |
Java | software.amazon.awscdk.services.rds.ProxyTarget |
Python | aws_cdk.aws_rds.ProxyTarget |
TypeScript (source) | @aws-cdk/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.AURORA,
instanceProps: { 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.
Cluster(cluster)
static frompublic static fromCluster(cluster: IDatabaseCluster): ProxyTarget
Parameters
- cluster
IDatabase
— RDS database cluster.Cluster
Returns
From cluster.
Instance(instance)
static frompublic static fromInstance(instance: IDatabaseInstance): ProxyTarget
Parameters
- instance
IDatabase
— RDS database instance.Instance
Returns
From instance.