public class App
{
public static void main( String[] args ) throws IOException
{
// TODO Auto-generated method stub
// TODO Auto-generated method stub
String containername = "archanatrial12";
String objectname = "object1";
String tempFile =
"/home/archana/Eclipse/trialV42/src/main/java/trialV41/trialV42/result.txt";
//int length;
// s3.amazonaws.com s3.eu-central-1.amazonaws.com
s3-external-1.amazonaws.com
BlobStoreContext context = ContextBuilder.newBuilder("aws-s3")
.credentials("XXXXXXXXXXX", "YYYYYYYYYYYYYYYYYYY")
.buildView(BlobStoreContext.class);
// Access the BlobStore
BlobStore blobStore = context.getBlobStore();
//Location loc = "us-east-1";
Location loc = new LocationBuilder().scope(LocationScope.REGION)
.id("eu-central-1")
.description("region")
.build();
// Create a Container
blobStore.createContainerInLocation(loc, containername);
// Create a Blob
File input = new
File("/home/archana/Eclipse/jclouds1/src/main/java/jclouds1/sample.txt");
long length = input.length();
// Add a Blob
Blob blob =
blobStore.blobBuilder(objectname).payload(Files.asByteSource(input)).contentLength(length)
.contentDisposition(objectname).build();
// Upload the Blob
String eTag = blobStore.putBlob(containername, blob);
System.out.println(eTag);}}
Error : requested location eu-central-1, which is not in the configured
locations
Solution to rectify the issue required
RegardsArchana