amazon-s3

How can I use a Lambda function to call a Glue function (ETL) when a text file is loaded to an S3 bucket

牧云@^-^@ 提交于 2020-01-04 05:55:27
问题 I am trying to set up a lambda function that activates a Glue function when a .txt file is uploaded to an S3 bucket, I am using python 3.7 So far I have this: from __future__ import print_function import json import boto3 import urllib print('Loading function') s3 = boto3.client('s3') def lambda_handler(event, context): # handler source_bucket = event['Records'][0]['s3']['bucket']['name'] key = urllib.parse.quote_plus(event['Records'][0]['s3']['object']['key'].encode('utf8')) try: # what to

PySpark job fails when loading multiple files and one is missing [duplicate]

眉间皱痕 提交于 2020-01-04 05:26:09
问题 This question already has an answer here : Pyspark Invalid Input Exception try except error (1 answer) Closed 10 months ago . When using PySpark to load multiple JSON files from S3 I get an error and the Spark job fails if a file is missing. Caused by: org.apache.hadoop.mapred.InvalidInputException: Input Pattern s3n://example/example/2017-02-18/*.json matches 0 files This is how I add the 5 last days to my job with PySpark. days = 5 x = 0 files = [] while x < days: filedate = (date.today() -

How to use AWS iOS SDK to delete a folder and all its objects in side bucket?

落花浮王杯 提交于 2020-01-04 05:17:41
问题 I am uploading objects to amazon s3 using AWS iOS SDK in Iphone, sometime error occurs and some of the objects are uploaded, remaining are not uploaded. I have created bucket and inside bucket i have created folder in which i have store my objects. I want to delete folder and all its object. Can anyone help me? 回答1: First of all, there is not such thing as "folders" in S3. Most S3 clients (including the AWS web console) show them as folders only for convenience (grouping stuff), but in fact,

How to implement a one-time write ticket to AWS S3 bucket?

筅森魡賤 提交于 2020-01-04 04:42:07
问题 guys. I am trying to implement some mechanism such that an anonymous AWS user can write to a specific S3 bucket that belongs to me, using a ticket provided by me(such as a random string). There may be restrictions on the object size and there should be a time limit( such as, write to the bucket within 1 hour after I issue the ticket to him). Is there any way to implement such thing using AWS S3 access policies? Thanks in advance! 回答1: Yes, this is possible using the Post Object API call on S3

Access Amazon s3 using http in angular2

自闭症网瘾萝莉.ら 提交于 2020-01-04 04:29:05
问题 I have a .json file in my Amazon s3 bucket when i try to access the file using http call in my Angular2 app i am getting an error Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://s3.us-east-2.amazonaws.com/....../list.json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). I made the file in my bucket to be public and gave the access as read, write and edit. Here is my Angular Code: getValue(){ return this._http.get('https://s3

Can I monitor the progress of an S3 download using the Cloud.AmazonAPI?

早过忘川 提交于 2020-01-04 04:06:14
问题 Is there a routine available in TAmazonStorageService to monitor the progress of a download of an object? I read that it is possible using the AWS SDK hooking the WriteObjectProgressEvent, but I couldn't find anything related in the documentation of Embarcadero's AmazonAPI. 回答1: I don't think this is currently implemented in Delphi. What you can do is create a stream wrapper that will notify about progress of writing to it. So for example you can write following to monitor progress via

How to change storage class of existing key via boto3

偶尔善良 提交于 2020-01-04 03:59:16
问题 When using AWS S3 service, I need to change storage class of existing key from STANDARD to STANDARD_IA. change_storage_class from boto doesn't exist in boto3. What is the equivalent in Boto3? 回答1: from amazon doc You can also change the storage class of an object that is already stored in Amazon S3 by copying it to the same key name in the same bucket. To do that, you use the following request headers in a PUT Object copy request: x-amz-metadata-directive set to COPY x-amz-storage-class set

React router links in app broken after move to cloudfront + SSL

不打扰是莪最后的温柔 提交于 2020-01-04 03:51:29
问题 I have a react app, using react-router hosted in an S3 bucket, using Route53 as a DNS provider. The app worked fine with the Route53 config pointing to the S3 bucket. Since I want to use SSL, I created a Cloudfront distribution pointing to the bucket, with an SSL cert., and pointed the DNS to it. Since doing that, none of the links work, (example.com works, but example.com/foo does not). It just returns a NoSuchKey error. I know that this is incorrect, as the key is definitely there, and it

Download a Large Number of Files Using the Java SDK for Amazon S3 Bucket

我的未来我决定 提交于 2020-01-04 02:58:16
问题 I have a large number of files that need to be downloaded from an S3 bucket. My problem is similar to this article except I am trying to run it in Java. public static void main(String args[]) { AWSCredentials myCredentials = new BasicAWSCredentials("key","secret"); TransferManager tx = new TransferManager(myCredentials); File file = <thefile> try{ MultipleFileDownload myDownload = tx.downloadDirectory("<bucket>", null, file); System.out.println("Transfer: " + myDownload.getDescription());

S3 parallel read and write performance?

旧街凉风 提交于 2020-01-04 02:12:15
问题 Consider a scenario where Spark (or any other Hadoop framework) reads a large (say 1 TB) file from S3. How does multiple spark executors read the very large file in parallel from S3. In HDFS this very large file will be distributed across multiple nodes with each node having a block of data. In object storage I presume this entire file will be in single node (ignoring replicas). This should drastically reduce the read throughput/performance. Similarly large file writes should also be much