Spring Cloud AWS SQS AccessDenied -
i having connection issue trying connect aws sqs queue using spring cloud , spring boot. believe have configured fine getting:
2015-07-01 18:12:11,926 [warn][-] org.springframework.boot.context.embedded.annotationconfigembeddedwebapplicationcontext[487] - exception encountered during context initialization - cancelling refresh attempt org.springframework.context.applicationcontextexception: failed start bean 'simplemessagelistenercontainer'; nested exception com.amazonaws.amazonserviceexception: access resource https://sqs.us-west-2.amazonaws.com/{number}/{queue name} denied. (service: amazonsqs; status code: 403; error code: accessdenied; request id: 87312428-ec0f-5990-9f69-6a269a041b4d)
@configuration @enablesqs public class cloudconfiguration { private static final logger log = logger.getlogger(cloudconfiguration.class); @messagemapping("queue") public void retrieveprovisionmessages(user user) { log.warn(user.firstname); } }
yml
cloud: aws: credentials.accesskey: accesskey credentials.secretkey: secretkey region.static: us-west-2 credentials.instanceprofile: true
when attempts connect see header value of:
aws4-hmac-sha256 credential=accesskey/20150701/us-west-2/sqs/aws4_request, signedheaders=host;user-agent;x-amz-date, signature=signature
after request sent:
http/1.1 403 forbidden [server: server, date: wed, 01 jul 2015 22:51:25 gmt, content-type: text/xml, content-length: 349, connection: keep-alive, x-amzn-requestid: request id] org.apache.http.conn.basicmanagedentity@37e55df6
i have checked aim policies , correct.
using:
private amazonsqs establishqueue(){ amazonsqs sqs = new amazonsqsclient(new basicawscredentials(accesskey, secretkey)); sqs.setregion(regionutils.getregion(region)); return sqs; } amazonsqs sqs = establishqueue(); return sqs.receivemessage(sqs.getqueueurl(userproductpurchase).getqueueurl());
with same credentials works fine. appreciated.
thanks
do have getqueueattributes
calls allowed iam user?
i think it's using few more operations. not receivemessage
, getqueueurl
.
Comments
Post a Comment