I am coding an app in .NET 5.0 to run on the desktop. It will query AWS CloudWatch and download log entries.
I am using the following method to create the AWS service client that contains the query method. When the program enters the CreateServiceClient()
method however, it hangs for a minute then returns directly to the method that calls my GetLogs()
method, with no error.
using Amazon.CloudWatchLogs;
using Amazon.CloudWatchLogs.Model;
using Amazon.Extensions.NETCore.Setup;
.
.
.
public async Task<GetQueryResultsResponse> GetLogs()
{
AWSOptions awsOptions = new AWSOptions { Profile = "myprofile" };
IAmazonCloudWatchLogs logs = awsOptions.CreateServiceClient<IAmazonCloudWatchLogs>();
.
.
.
I have a credentials file located at C:\Users\Username\.aws\credentials
with the contents
[myprofile]
aws_access_key_id = <myid>
aws_secret_access_key = <mykey>
I have verified the credentials work with AWS CLI. What am I missing?