connecting to AWS S...
 
Notifications
Clear all

[Solved] connecting to AWS S3 connection error PermanentRedirect

2 Posts
1 Users
0 Likes
630 Views
Posts: 205
 CWL
Admin
Issue starter
(@cwl)
Member
Joined: 11 years ago

When trying to AWS S3 via Named Credentials getting the error 

PermanentRedirectThe bucket you are
attempting to access must be addressed using the specified endpoint.
Please send all future requests to this
endpoint.fol.s3-us-west-2.amazonaws.comfol

1 Reply
Posts: 205
 CWL
Admin
Issue starter
(@cwl)
Member
Joined: 11 years ago

Actually it could be because of not including the bucket name in the URL and it might have been given as https://s3.ap-south-1.amazonaws.com/folder1/folder1a/.  

Try the url as: https://s3.ap-south-1.amazonaws.com/bucket-name/folder1/folder1a/

You shoud get 200 Status Ok printed in the debug console. REST API code to connect to s3:

HttpRequest req = new HttpRequest();
req.setEndpoint('callout:AWS_S3'); // named credentials name
req.setMethod('GET');
req.setHeader('Content-Type','application/xml');
Http http = new Http();
HTTPResponse res = http.send(req);
System.debug(res.getBody());
System.debug(res.getStatusCode());
System.debug(res.getStatus());

Reply
Share: