Error when try to set Certificate to None in Distribution #2010
-
Describe the bugHello,
Running this code I get this error message:
Expected BehaviorThe response from call should be httpcode 200. Current Behavior
Reproduction Steps
Possible SolutionNo response Additional Information/ContextNo response AWS .NET SDK and/or Package version usedAWSSDK.CloudFront 3.7.4.60 Targeted .NET Platform.net 6.0 Operating System and versionWindows 11 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Using the below minimal .NET 6 code as provided by customer: // See https://aka.ms/new-console-template for more information
using Amazon.CloudFront;
using Amazon.CloudFront.Model;
string cloudDistributionId = "<<specify your distribution id>>";
AmazonCloudFrontClient amazonCloudFrontClient = new AmazonCloudFrontClient();
var getDistributionRequest = new GetDistributionRequest() { Id = cloudDistributionId };
var dist = amazonCloudFrontClient.GetDistributionAsync(getDistributionRequest).Result;
var viewerCertificate = new ViewerCertificate()
{
CloudFrontDefaultCertificate = false,
MinimumProtocolVersion = MinimumProtocolVersion.TLSv1
};
dist.Distribution.DistributionConfig.ViewerCertificate = viewerCertificate;
var request = new UpdateDistributionRequest() { DistributionConfig = dist.Distribution.DistributionConfig, Id = cloudDistributionId, IfMatch = dist.ETag };
var update = amazonCloudFrontClient.UpdateDistributionAsync(request).Result;
Console.WriteLine(update.Distribution.DistributionConfig.ViewerCertificate.ACMCertificateArn == null); returns the error:
@paulofloresjunior I'm not sure if you are using the correct values. Per your issue, you are trying to set the ViewerCertificate of distribution in CloudFront to Few references:
Also, instead of retrieving the complete distribution details, you could use GetDistributionConfig to get only the config and then use it to update distribution. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Using the below minimal .NET 6 code as provided by customer: