TYL
TYL

Reputation: 1637

AWS AppRunner getting "Unable to locate credentials" error when calling SNS in the cloud

I have my application deployed on AWS AppRunner, which will call SNS to send an email.

mysns = boto3.client(
    "sns", 
)
response = mysns.publish(
    TopicArn = self.TOPIC_ARN,
    Message=message,
    Subject=subject,
)

I have set up an IAM role and gave it the policies AmazonSNSFullAccess and AWSAppRunnerServicePolicyForECRAccess

Trust relationship is as follows:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "build.apprunner.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}

However, it still keeps giving an error botocore.exceptions.NoCredentialsError: Unable to locate credentials.

Upvotes: 0

Views: 66

Answers (0)

Related Questions