AWS SDK SESV2 for .Net ListContacts failure

0

I can't understand why I can get a contact name with my specified credentials and policy but not list contacts. These same credentials and policy work in the CLI for listing contacts. ...

Error: Amazon.SimpleEmailV2.AmazonSimpleEmailServiceV2Exception: '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.'

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Amazon.SimpleEmailV2.Model;
using Amazon.SimpleEmailV2;
using static System.Net.Mime.MediaTypeNames;
using System.Linq.Expressions;
using Amazon.Runtime;


namespace NewsLetterGenerator
{
    internal class Program
    {
        static async Task Main(string[] args)
        {

            var client = new AmazonSimpleEmailServiceV2Client("ID", "SECRET");
            
            // works
            var cRequest = new GetContactRequest();
            cRequest.ContactListName = "fmContacts";
            cRequest.EmailAddress = "brduffy@gmail.com";
            GetContactResponse response = await client.GetContactAsync(cRequest);

            Console.Write(response.EmailAddress);

            // fails  
            var cRequest = new ListContactsRequest();
            cRequest.ContactListName = "fmContacts" ;
            ListContactsResponse response = await client.ListContactsAsync(cRequest);
            Console.Write(response.Contacts);

            Console.ReadLine();

        }


    }
}

Policy ...

"Version": "2012-10-17", "Statement": [ { "Sid": "Statement1", "Effect": "Allow", "Action": [ "ses:SendEmail", "ses:GetContact", "ses:GetContactList", "ses:CreateContactList", "ses:CreateContact", "ses:DeleteContact", "ses:DeleteContactList", "ses:ListContactLists", "ses:ListContacts" ], "Resource": [ "*" ] } ] }

  • I tried the same thing using python boto3 and it works with my existing cli credentials ... import boto3

    works

    sesv2 = boto3.client('sesv2')

    response = sesv2.list_contacts( ContactListName='fmContacts', PageSize=123 ) print(response)

No Answers

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