Exemple #1
0
    public MyStack()
    {
        var network = new Aws.CloudFormation.Stack("network", new Aws.CloudFormation.StackArgs
        {
            Parameters =
            {
                { "VPCCidr", "10.0.0.0/16" },
            },
            TemplateBody = @"{
  ""Parameters"" : {
    ""VPCCidr"" : {
      ""Type"" : ""String"",
      ""Default"" : ""10.0.0.0/16"",
      ""Description"" : ""Enter the CIDR block for the VPC. Default is 10.0.0.0/16.""
    }
  },
  ""Resources"" : {
    ""myVpc"": {
      ""Type"" : ""AWS::EC2::VPC"",
      ""Properties"" : {
        ""CidrBlock"" : { ""Ref"" : ""VPCCidr"" },
        ""Tags"" : [
          {""Key"": ""Name"", ""Value"": ""Primary_CF_VPC""}
        ]
      }
    }
  }
}

",
        });
    }
    static Task <int> Main()
    {
        return(Deployment.RunAsync(() => {
            // Use a copy of the OpenVidu project's CloudFormation template
            var template = System.IO.File.ReadAllText("CF-OpenVidu-latest.yaml");

            // Retrieve OpenViduSecret environment variable
            string OpenViduSecret = Environment.GetEnvironmentVariable("OpenViduSecret");

            // Build a CloudFormation Stack using the template and parameters
            var stack = new CloudFormation.Stack("video", new CloudFormation.StackArgs
            {
                TemplateBody = template,
                Parameters = new Dictionary <string, object?>
                {
                    { "WhichCert", "letsencrypt" },
                    { "LetsEncryptEmail", "*****@*****.**" },
                    { "MyDomainName", "video.synthesys.com.au" },
                    { "PublicElasticIP", "13.55.83.223" },
                    { "OpenViduSecret", OpenViduSecret },
                    { "InstanceType", "t2.large" },
                    { "KeyName", "ssh1.synthesys.com.au" },
                    { "WantToDeployDemos", "true" },
                    // Template settings required not needed
                    { "OwnCertKEY", "not needed" },
                    { "OwnCertCRT", "not needed" },
                    { "OpenViduWebhookHeaders", "not needed" },
                },
            });

            // Export the outputs from the CloudFormation stack
            return new Dictionary <string, object?>
            {
                { "WebsiteURL", stack.Outputs.Apply(sk => sk["WebsiteURL"]) },
                { "WebsiteURLLE", stack.Outputs.Apply(sk => sk["WebsiteURLLE"]) },
                { "DemosURL", stack.Outputs.Apply(sk => sk["DemosURL"]) },
                { "DemosURLLE", stack.Outputs.Apply(sk => sk["DemosURLLE"]) },
            };
        }));
    }