List of usage examples for com.amazonaws.regions Regions EU_WEST_1
Regions EU_WEST_1
To view the source code for com.amazonaws.regions Regions EU_WEST_1.
Click Source Link
From source file:AWS.java
/** * Creates new form main/*from ww w . j a v a 2s . c om*/ */ public AWS() { AWSCredentials credentials = new ProfileCredentialsProvider().getCredentials(); String endPoint; Region region; endPoint = "https://ec2.eu-west-1.amazonaws.com"; region = Region.getRegion(Regions.EU_WEST_1); ec2client = new AmazonEC2Client(credentials); ec2client.setEndpoint(endPoint); ec2client.setRegion(region); initComponents(); }
From source file:com.clouddrive.parth.NewClass.java
public static void init(String instanceType, String noOfinstances) throws Exception { INSTANCE_COUNT = Integer.parseInt(noOfinstances); switch (instanceType) { case "C1Medium": INSTANCE_TYPE = InstanceType.C1Medium.toString(); break;// w w w . jav a 2 s. c o m case "C1Xlarge": INSTANCE_TYPE = InstanceType.C1Xlarge.toString(); break; case "C32xlarge": INSTANCE_TYPE = InstanceType.C32xlarge.toString(); break; case "C34xlarge": INSTANCE_TYPE = InstanceType.C34xlarge.toString(); break; case "C38xlarge": INSTANCE_TYPE = InstanceType.C38xlarge.toString(); break; case "C3Large": INSTANCE_TYPE = InstanceType.C3Large.toString(); break; case "C3Xlarge": INSTANCE_TYPE = InstanceType.C3Xlarge.toString(); break; case "Cc14xlarge": INSTANCE_TYPE = InstanceType.Cc14xlarge.toString(); break; case "Cc28xlarge": INSTANCE_TYPE = InstanceType.Cc28xlarge.toString(); break; case "Cg14xlarge": INSTANCE_TYPE = InstanceType.Cg14xlarge.toString(); break; case "Cr18xlarge": INSTANCE_TYPE = InstanceType.Cr18xlarge.toString(); break; case "G22xlarge": INSTANCE_TYPE = InstanceType.G22xlarge.toString(); break; case "T1Micro": INSTANCE_TYPE = InstanceType.T1Micro.toString(); break; } //AWSCredentials credentials = new PropertiesCredentials(NewClass.class.getClassLoader().getResourceAsStream( // "AwsCredentials.properties")); // s3 = new AmazonS3Client(credentials); String secretKey = "kxDFnyETb02UrLr4YT3bRjiET+/FNGUMrE3DrU4j"; String accessKey = "AKIAII3DXT3OYD5UV4WQ"; BasicAWSCredentials awsCreds = new BasicAWSCredentials(accessKey, secretKey); s3 = new AmazonS3Client(awsCreds); Region usWest2 = Region.getRegion(Regions.US_WEST_2); ((AmazonWebServiceClient) s3).setRegion(usWest2); emr = new AmazonElasticMapReduceClient(awsCreds); emr.setRegion(Region.getRegion(Regions.EU_WEST_1)); }
From source file:com.jktsoftware.amazondownloader.queuemanager.DownloaderQueueManager.java
License:Open Source License
public void CreateQueues() { AWSCredentials awscredentials = new BasicAWSCredentials(this._credentials.getAccessKey(), this._credentials.getSecretAccessKey()); _sqs = new AmazonSQSClient(awscredentials); Region euWest1 = Region.getRegion(Regions.EU_WEST_1); _sqs.setRegion(euWest1);//from w w w .j a v a 2s. c om System.out.println("Creating amazon download queues.\n"); CreateQueueRequest createReceivedQueueRequest = new CreateQueueRequest(_receivedqueuename); this._receivedqueueurl = _sqs.createQueue(createReceivedQueueRequest).getQueueUrl(); CreateQueueRequest createFailedQueueRequest = new CreateQueueRequest(_failedqueuename); this._failedqueueurl = _sqs.createQueue(createFailedQueueRequest).getQueueUrl(); }
From source file:com.kiribuki.queueservice.QueueService.java
License:Open Source License
public QueueService() throws Exception { Region euWest1 = Region.getRegion(Regions.EU_WEST_1); try {//from ww w . j a v a2 s .c o m sqs.setRegion(euWest1); swok = true; } catch (Exception e) { swok = false; } }
From source file:com.meteotester.util.S3Util.java
License:Open Source License
public static void saveFileToS3(File file) { try {//from w ww . jav a 2 s. c om AWSCredentials myCredentials = new BasicAWSCredentials(Config.AWS_ACCESS_KEY, Config.AWS_SECRET_KEY); AmazonS3 s3client = new AmazonS3Client(myCredentials); s3client.setRegion(Region.getRegion(Regions.EU_WEST_1)); String filename = file.getName(); String path = file.getPath(); PutObjectRequest req = new PutObjectRequest(Config.S3_BUCKETNAME, path, file); ObjectMetadata metadata = new ObjectMetadata(); metadata.setContentLength(file.length()); String contentType = (filename.contains("json")) ? "application/json" : "text/csv"; metadata.setContentType(contentType); req.setMetadata(metadata); s3client.putObject(req); log.info(filename + " stored in S3"); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.takeatrip.Utilities.UtilS3Amazon.java
License:Open Source License
/** * Gets an instance of CognitoCachingCredentialsProvider which is * constructed using the given Context.// w w w.j a v a 2s .com * * @param context An Context instance. * @return A default credential provider. */ private static CognitoCachingCredentialsProvider getCredProvider(Context context) { if (sCredProvider == null) { sCredProvider = new CognitoCachingCredentialsProvider(context.getApplicationContext(), Constants.AMAZON_POOL_ID, Regions.EU_WEST_1); } return sCredProvider; }
From source file:dataMappers.PictureDataMapper.java
public static void addPictureToReport(DBConnector dbconnector, HttpServletRequest request) throws FileUploadException, IOException, SQLException { if (!ServletFileUpload.isMultipartContent(request)) { System.out.println("Invalid upload request"); return;/*from w w w .j av a 2 s . com*/ } // Define limits for disk item DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(THRESHOLD_SIZE); // Define limit for servlet upload ServletFileUpload upload = new ServletFileUpload(factory); upload.setFileSizeMax(MAX_FILE_SIZE); upload.setSizeMax(MAX_REQUEST_SIZE); FileItem itemFile = null; int reportID = 0; // Get list of items in request (parameters, files etc.) List formItems = upload.parseRequest(request); Iterator iter = formItems.iterator(); // Loop items while (iter.hasNext()) { FileItem item = (FileItem) iter.next(); if (!item.isFormField()) { itemFile = item; // If not form field, must be item } else if (item.getFieldName().equalsIgnoreCase("reportID")) { // else it is a form field try { System.out.println(item.getString()); reportID = Integer.parseInt(item.getString()); } catch (NumberFormatException e) { reportID = 0; } } } // This will be null if no fields were declared as image/upload. // Also, reportID must be > 0 if (itemFile != null || reportID == 0) { try { // Create credentials from final vars BasicAWSCredentials awsCredentials = new BasicAWSCredentials(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY); // Create client with credentials AmazonS3 s3client = new AmazonS3Client(awsCredentials); // Set region s3client.setRegion(Region.getRegion(Regions.EU_WEST_1)); // Set content length (size) of file ObjectMetadata om = new ObjectMetadata(); om.setContentLength(itemFile.getSize()); // Get extension for file String ext = FilenameUtils.getExtension(itemFile.getName()); // Generate random filename String keyName = UUID.randomUUID().toString() + '.' + ext; // This is the actual upload command s3client.putObject(new PutObjectRequest(S3_BUCKET_NAME, keyName, itemFile.getInputStream(), om)); // Picture was uploaded to S3 if we made it this far. Now we insert the row into the database for the report. PreparedStatement stmt = dbconnector.getCon() .prepareStatement("INSERT INTO reports_pictures" + "(REPORTID, PICTURE) VALUES (?,?)"); stmt.setInt(1, reportID); stmt.setString(2, keyName); stmt.executeUpdate(); stmt.close(); } catch (AmazonServiceException ase) { System.out.println("Caught an AmazonServiceException, which " + "means your request made it " + "to Amazon S3, but was rejected with an error response" + " for some reason."); System.out.println("Error Message: " + ase.getMessage()); System.out.println("HTTP Status Code: " + ase.getStatusCode()); System.out.println("AWS Error Code: " + ase.getErrorCode()); System.out.println("Error Type: " + ase.getErrorType()); System.out.println("Request ID: " + ase.getRequestId()); } catch (AmazonClientException ace) { System.out.println("Caught an AmazonClientException, which " + "means the client encountered " + "an internal error while trying to " + "communicate with S3, " + "such as not being able to access the network."); System.out.println("Error Message: " + ace.getMessage()); } } }
From source file:es.logongas.fpempresa.service.mail.impl.MailServiceImplAWS.java
License:Open Source License
@Override public void send(Mail mail) { try {/*from w w w . ja va2 s . c om*/ Session session = Session.getDefaultInstance(new Properties()); Message message = JavaMailHelper.getMessage(mail, session); //Aqu es el proceso de envio AWSCredentials credentials = new BasicAWSCredentials(Config.getSetting("aws.accessKey"), Config.getSetting("aws.secretKey")); AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceAsyncClient(credentials); Region REGION = Region.getRegion(Regions.EU_WEST_1); client.setRegion(REGION); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); message.writeTo(outputStream); RawMessage rawMessage = new RawMessage(ByteBuffer.wrap(outputStream.toByteArray())); SendRawEmailRequest rawEmailRequest = new SendRawEmailRequest(rawMessage); client.sendRawEmail(rawEmailRequest); } catch (IllegalArgumentException | IOException | MessagingException ex) { throw new RuntimeException(ex); } }
From source file:io.kodokojo.service.aws.Route53DnsManager.java
License:Open Source License
public Route53DnsManager(String domainName, Region region) { if (isBlank(domainName)) { throw new IllegalArgumentException("domainName must be defined."); }//w w w .j av a 2 s .c o m this.domainName = domainName.endsWith(".") ? domainName : domainName + "."; AWSCredentials credentials = new DefaultAWSCredentialsProviderChain().getCredentials(); client = new AmazonRoute53Client(credentials); client.setRegion(region == null ? Region.getRegion(Regions.EU_WEST_1) : region); }
From source file:it.simona.microservice.Microservice.java
public static void main(String[] args) { if ((args.length == 1) && (args[0].equals("local"))) { System.out.println("Starting Jersey REST-full Service with JDK HTTP Server ..."); System.out.println("DynamoDB on local machine"); System.out//from w w w . j a va 2 s . com .println("http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html"); client.withEndpoint("http://localhost:8000"); } else { System.out.println("Starting Jersey REST-full Service with JDK HTTP Server ..."); System.out.println("DynamoDB on AWS"); client.withRegion(Regions.EU_WEST_1); } URI baseUri = UriBuilder.fromUri("http://localhost/v1").port(8080).build(); ResourceConfig config = new ResourceConfig(); config.register(new Ping()); config.register(new BorsaResource(client)); // config.register(new CarResource(client)); HttpServer server = JdkHttpServerFactory.createHttpServer(baseUri, config); }