Can't change Amazon Recovery Controller controls states with .net SDK

0

I am trying to run an application that can change the control states using the .net SDK .

I am getting the cluster endpoints from the DescribeClusterAsync method on the AmazonRoute53RecoveryControlConfigClient class with no issues.

Then I attempt to run this code where I setup the AmazonRoute53RecoveryClusterClient :

AmazonRoute53RecoveryClusterConfig clusterRecoveryConfig = new AmazonRoute53RecoveryClusterConfig();
clusterRecoveryConfig.RegionEndpoint = RegionEndpoint.GetBySystemName(clusterEndpoint.Region);
  
AmazonRoute53RecoveryClusterClient client = new AmazonRoute53RecoveryClusterClient(_awsCredentials, clusterRecoveryConfig);

When I attempt to execute the GetRoutingControlStateAsync on the client:

await GetRoutingControlStateAsync(request);  

I get an error stating: The requested name is valid, but no data of the requested type was found.

I have tried removing the Region and passing a cluster endpoint to ServiceURL but then I get this error: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

I think I need to pass in the url endpoint to the client, but am unsure how to do it.

I have a stack overflow question on this same topic here: https://stackoverflow.com/questions/71042116/aws-route53-recovery-controller-error-when-getting-or-updating-the-control-state

I see in the java example you can set the region and the data plane url endpoint, but I don't see the equivalent in .net.

https://docs.aws.amazon.com/r53recovery/latest/dg/example_route53-recovery-cluster_UpdateRoutingControlState_section.html

This works when I use the cli which I can also set the region and url endpoint.

https://docs.aws.amazon.com/r53recovery/latest/dg/getting-started-cli-routing.control-state.html

What am I doing wrong here?

Any guidance would be greatly appreciated.

asked 2 years ago243 views
3 Answers
0

Hi,

I looked at your code on stack overflow and noticed that the following property is set

clusterConfig.RegionEndpoint = RegionEndpoint.GetBySystemName(clusterEndpoint.Region);

Could you also try setting the following property and see if it works?

clusterRecoveryConfig.ServiceURL = RegionEndpoint.GetBySystemName(clusterEndpoint.Endpoint);

Thanks,

AWS
SUPPORT ENGINEER
answered 2 years ago
0

Thank you for reaching out.

I have done what you have asked and I get this error: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

I have created an issue with the AWS .Net SDK folks and they have labeled this as a bug. https://github.com/aws/aws-sdk-net/issues/1978

Once I have a resolution I will post it here and on the Stack Overflow question I have asked.

answered 2 years ago
0

There is a solution to this question here: https://github.com/aws/aws-sdk-net/issues/1978.

Essentially use the ServiceURL on the configuration object and add a trailing / to the endpoint url.

AmazonRoute53RecoveryClusterConfig clusterRecoveryConfig = new AmazonRoute53RecoveryClusterConfig();
clusterRecoveryConfig.ServiceURL = $"{clusterEndpoint.Endpoint}/";

AmazonRoute53RecoveryClusterClient client = new AmazonRoute53RecoveryClusterClient(_awsCredentials, clusterRecoveryConfig);
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions