0

I have created a S3 bucket and uploaded the two files to the bucket via AWS .Net SDK, I can access files with HTTP, but I need access the files with HTTPS (SSL Secured) for that I have created the certificate request using the RequestCertificateAsync method of AmazonCertificateManagerClient, but I couldn't find a way to assign the created certificate to the specific bucket via programmatically.

This is the code I have used to request the certificate

public static void CertificateCreation()
{
     AmazonCertificateManagerConfig acmConfig = new AmazonCertificateManagerConfig();
     var credentials = new BasicAWSCredentials(accessKeyID, secretKey);
     acmConfig.RegionEndpoint = Amazon.RegionEndpoint.USWest1;
     AmazonCertificateManagerClient client = new AmazonCertificateManagerClient(credentials, acmConfig);

     RequestCertificateRequest request = new RequestCertificateRequest()
     {
         CertificateAuthorityArn = "arn-value",
         DomainName = "damain_name",
         ValidationMethod = "DNS",
     };

     var response = client.RequestCertificateAsync(request);

     while (TaskStatus.Created == client.RequestCertificateAsync(request).Status)
     {
          Console.WriteLine("Change is pending.");
            Thread.Sleep(15000);
     }
}
    

I doesn't have idea to move further, to assign the SSL certificate to specific bucket. Is anyone can help to accomplish this task much appreciated.

Shakir Ahamed
  • 1,290
  • 3
  • 16
  • 39

1 Answers1

2

You can't setup SSL cert directly on your bucket website. The way to do it is through CloudFront (CF). So you would front your bucket website with CF distribution.

By default CF gives your HTTPS and its own random domain. If you prefare to have custom domain, you have to buy one and get SSL certificate for it from ACM. Then you associated the domain and the cert with your CF distro:

Marcin
  • 215,873
  • 14
  • 235
  • 294