Class AppSyncRdsDataSource
An AppSync datasource backed by RDS.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AppSyncRdsDataSource : AppSyncBackedDataSource, IGrantable
Syntax (vb)
Public Class AppSyncRdsDataSource Inherits AppSyncBackedDataSource Implements IGrantable
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.SecretsManager;
Vpc vpc;
var databaseName = "mydb";
var cluster = new DatabaseCluster(this, "Cluster", new DatabaseClusterProps {
Engine = DatabaseClusterEngine.AuroraPostgres(new AuroraPostgresClusterEngineProps { Version = AuroraPostgresEngineVersion.VER_16_6 }),
Writer = ClusterInstance.ServerlessV2("writer"),
Vpc = vpc,
Credentials = new Dictionary<string, string> { { "username", "clusteradmin" } },
DefaultDatabaseName = databaseName,
EnableDataApi = true
});
var secret = Secret.FromSecretNameV2(this, "Secret", "db-secretName");
var api = new EventApi(this, "EventApiRds", new EventApiProps {
ApiName = "RdsEventApi"
});
var dataSource = api.AddRdsDataSource("rdsds", cluster, secret, databaseName);
Synopsis
Constructors
| AppSyncRdsDataSource(Construct, string, IAppSyncRdsDataSourceProps) | An AppSync datasource backed by RDS. |
Constructors
AppSyncRdsDataSource(Construct, string, IAppSyncRdsDataSourceProps)
An AppSync datasource backed by RDS.
public AppSyncRdsDataSource(Construct scope, string id, IAppSyncRdsDataSourceProps props)
Parameters
- scope Construct
- id string
- props IAppSyncRdsDataSourceProps
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.SecretsManager;
Vpc vpc;
var databaseName = "mydb";
var cluster = new DatabaseCluster(this, "Cluster", new DatabaseClusterProps {
Engine = DatabaseClusterEngine.AuroraPostgres(new AuroraPostgresClusterEngineProps { Version = AuroraPostgresEngineVersion.VER_16_6 }),
Writer = ClusterInstance.ServerlessV2("writer"),
Vpc = vpc,
Credentials = new Dictionary<string, string> { { "username", "clusteradmin" } },
DefaultDatabaseName = databaseName,
EnableDataApi = true
});
var secret = Secret.FromSecretNameV2(this, "Secret", "db-secretName");
var api = new EventApi(this, "EventApiRds", new EventApiProps {
ApiName = "RdsEventApi"
});
var dataSource = api.AddRdsDataSource("rdsds", cluster, secret, databaseName);