Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

S3 route problem when access key and secret key are in URI

$
0
0
I am using Camel 2.14.1
When I build a S3 route and specify the accessKey and secretKey in the URI, I got the following exception.(Note that I have URL encoded my secret key so that "+" is replaced by "%2B". )
String awsURLTemplate="aws-s3://%s?accessKey=%s&secretKey=%s&region=eu-west-1"; final String awsURL = String.format(awsURLTemplate,bucketName, accessKey,secretKey); DefaultCamelContext context = new DefaultCamelContext(); context.addRoutes(new RouteBuilder() { public void configure() { from("direct:start").to(awsURL).to("stream:out"); } });

Exception in thread "main" org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[aws-s3://myBucket?accessKey=***&secretKey=***&region=eu-west-1] <<< in route: Route(route1)[[From[direct:start]] -> [To[aws-s3://... because of Failed to resolve endpoint: aws-s3://myBucket?accessKey=***&region=eu-west-1&secretKey=**** due to: The request signature we calculated does not match the signature you provided. Check your key and signing method. (Service: Amazon S3; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: C227F0C1D0D16660) at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:945) at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:187) at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:805) at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:2174) at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1906) at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1767) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1735) at net.sf.camel.s3.S3Demo2.run(S3Demo2.java:58)

But it works  if the accessKey and secretKey are specified in a registry as described in http://camel.apache.org/aws-s3.html Thanks in advance for any assistance !
Shing

Viewing all articles
Browse latest Browse all 5648

Trending Articles