Beispiel #1
0
 public MyStack()
 {
     var primary = new Aws.Provider("primary", new Aws.ProviderArgs
     {
         Region = "us-east-2",
     });
     var secondary = new Aws.Provider("secondary", new Aws.ProviderArgs
     {
         Region = "us-west-2",
     });
     var example = new Aws.Rds.GlobalCluster("example", new Aws.Rds.GlobalClusterArgs
     {
         GlobalClusterIdentifier = "example",
     }, new CustomResourceOptions
     {
         Provider = "aws.primary",
     });
     var primaryCluster = new Aws.Rds.Cluster("primaryCluster", new Aws.Rds.ClusterArgs
     {
         EngineMode = "global",
         GlobalClusterIdentifier = example.Id,
     }, new CustomResourceOptions
     {
         Provider = "aws.primary",
     });
     var primaryClusterInstance = new Aws.Rds.ClusterInstance("primaryClusterInstance", new Aws.Rds.ClusterInstanceArgs
     {
         ClusterIdentifier = primaryCluster.Id,
     }, new CustomResourceOptions
     {
         Provider = "aws.primary",
     });
     var secondaryCluster = new Aws.Rds.Cluster("secondaryCluster", new Aws.Rds.ClusterArgs
     {
         EngineMode = "global",
         GlobalClusterIdentifier = example.Id,
     }, new CustomResourceOptions
     {
         Provider  = "aws.secondary",
         DependsOn =
         {
             "aws_rds_cluster_instance.primary",
         },
     });
     var secondaryClusterInstance = new Aws.Rds.ClusterInstance("secondaryClusterInstance", new Aws.Rds.ClusterInstanceArgs
     {
         ClusterIdentifier = secondaryCluster.Id,
     }, new CustomResourceOptions
     {
         Provider = "aws.secondary",
     });
 }
Beispiel #2
0
 public MyStack()
 {
     var @default = new Aws.Rds.Cluster("default", new Aws.Rds.ClusterArgs
     {
         AvailabilityZones =
         {
             "us-west-2a",
             "us-west-2b",
             "us-west-2c",
         },
         BackupRetentionPeriod = 5,
         ClusterIdentifier     = "aurora-cluster-demo",
         DatabaseName          = "mydb",
         MasterPassword        = "******",
         MasterUsername        = "******",
         PreferredBackupWindow = "07:00-09:00",
     });
     var test1 = new Aws.Rds.ClusterInstance("test1", new Aws.Rds.ClusterInstanceArgs
     {
         ApplyImmediately  = true,
         ClusterIdentifier = @default.Id,
         Identifier        = "test1",
         InstanceClass     = "db.t2.small",
     });
     var test2 = new Aws.Rds.ClusterInstance("test2", new Aws.Rds.ClusterInstanceArgs
     {
         ApplyImmediately  = true,
         ClusterIdentifier = @default.Id,
         Identifier        = "test2",
         InstanceClass     = "db.t2.small",
     });
     var test3 = new Aws.Rds.ClusterInstance("test3", new Aws.Rds.ClusterInstanceArgs
     {
         ApplyImmediately  = true,
         ClusterIdentifier = @default.Id,
         Identifier        = "test3",
         InstanceClass     = "db.t2.small",
     });
     var eligible = new Aws.Rds.ClusterEndpoint("eligible", new Aws.Rds.ClusterEndpointArgs
     {
         ClusterEndpointIdentifier = "reader",
         ClusterIdentifier         = @default.Id,
         CustomEndpointType        = "READER",
         ExcludedMembers           =
         {
             test1.Id,
             test2.Id,
         },
     });
     var @static = new Aws.Rds.ClusterEndpoint("static", new Aws.Rds.ClusterEndpointArgs
     {
         ClusterEndpointIdentifier = "static",
         ClusterIdentifier         = @default.Id,
         CustomEndpointType        = "READER",
         StaticMembers             =
         {
             test1.Id,
             test3.Id,
         },
     });
 }