amazon-s3

Querying S3 using Athena

穿精又带淫゛_ 提交于 2020-07-10 07:40:12
问题 I have a setup with Kinesis Firehose ingesting data, AWS Lambda performing data transformation and dropping the incoming data into an S3 bucket. The S3 structure is organized by year/month/day/hour/messages.json, so all of the actual json files I am querying are at the 'hour' level with all year, month, day directories only containing sub directories. My problem is I need to run a query to get all data for a given day. Is there an easy way to query at the 'day' directory level and return all

Automatically setting a bucket policy in AWS S3. How do I obtain the new buckets name for the script to refer to?

痞子三分冷 提交于 2020-07-10 06:27:35
问题 This script requires the name of the new bucket in order to be attached. However, it would not receive the name of the new S3 bucket to be referred to in the script. What way can I obtain the name of the new bucket automatically in this script? import json # Create a bucket policy bucket_name = 'BUCKET_NAME' bucket_policy = { 'Version': '2012-10-17', 'Statement': [{ 'Sid': 'AddPerm', 'Effect': 'Allow', 'Principal': '*', 'Action': ['s3:GetObject'], 'Resource': f'arn:aws:s3:::{bucket_name}/*' }

Python Boto3 - how to check if s3 file is completely written before process start copying to another bucket

ぐ巨炮叔叔 提交于 2020-07-09 15:07:49
问题 How to make sure that Process A has completely written large file (5+ GB) in AWS S3 Bucket A before Process B starts copying file to AWS S3 Bucket B using boto3? 回答1: If a new object is being created in Amazon S3, it will only appear after the upload is complete. Other processes will not be able to view it until is has finished uploading. Objects cannot be updated in S3. Rather, they are replaced with a new object. So, if an object is in the process of being updated, it will still appear as

Python Boto3 - how to check if s3 file is completely written before process start copying to another bucket

扶醉桌前 提交于 2020-07-09 15:07:29
问题 How to make sure that Process A has completely written large file (5+ GB) in AWS S3 Bucket A before Process B starts copying file to AWS S3 Bucket B using boto3? 回答1: If a new object is being created in Amazon S3, it will only appear after the upload is complete. Other processes will not be able to view it until is has finished uploading. Objects cannot be updated in S3. Rather, they are replaced with a new object. So, if an object is in the process of being updated, it will still appear as

AWS Athena query returns results in incorrect format when query is run again

可紊 提交于 2020-07-09 04:30:09
问题 The first time I ran the query, it returned 2 rows with columns names. I edited the table and added skip.header.line.count - 1 and reran(First time), but it returned same result with double inverted commas. Then reran again(Second time), and this changed everything. First time Query run output: https://i.stack.imgur.com/k6T2O.png Second time Query run output: https://i.stack.imgur.com/6Cxrf.png 回答1: The problem is that output files from Amazon Athena are being mixed-in with your source files.

How to start pm2 website using jenkins on AWS ubuntu server?

生来就可爱ヽ(ⅴ<●) 提交于 2020-07-09 03:48:08
问题 I set up Jenkins , pm2 on AWS ubuntu server. I had a website A that built by jenkins . The jenkins then will start that website by pm2 in the configured shell. However, only I start the website by logging on to the ubuntu server manually and run pm2 start A can make the website running. The problem seems that pm2 started by user jenkins will not be visible by the outside world. Only started by user ubuntu (via ssh ubuntu@myubuntuserver) can be effectively public. Why and how can I make

AWS signature problems with IE

≡放荡痞女 提交于 2020-07-09 02:37:37
问题 i'm currently working on file upload directly to S3. The user should have the ability to drag a file/files to a defined part of the site. Then a request to my server starts and generates signatures for the uploaded file/files At first i request valid signatures which are calculated from the server. The generated signature(s) looks like this: [ { "success_action_status":"<status>successful</status>", "formAction":"http://[mybucket].s3.amazonaws.com", "Policy":

AWS signature problems with IE

|▌冷眼眸甩不掉的悲伤 提交于 2020-07-09 02:37:09
问题 i'm currently working on file upload directly to S3. The user should have the ability to drag a file/files to a defined part of the site. Then a request to my server starts and generates signatures for the uploaded file/files At first i request valid signatures which are calculated from the server. The generated signature(s) looks like this: [ { "success_action_status":"<status>successful</status>", "formAction":"http://[mybucket].s3.amazonaws.com", "Policy":

Flask & Boto3 `ValueError: Required parameter name not set` on Accessing Resource

别说谁变了你拦得住时间么 提交于 2020-07-08 11:07:20
问题 Every time I run my app, it works until I send a request to the /files route, where I get a ValueError: Required parameter name not set . The error does not specify what parameter is not set. from flask import ( Flask, render_template, redirect, url_for, g, session, flash, request ) from flask_session import Session from flask_bootstrap import Bootstrap from flask_wtf import FlaskForm from flask_wtf.file import FileField from datetime import datetime from wtforms import StringField,

How to copy from one bucket to another bucket in s3 of certain suffix

我的未来我决定 提交于 2020-07-08 06:24:10
问题 I have 3 buckets 1.commonfolder 2.jsonfolder 3.csvfolder . Common folder will be having both json and csv files need to copy all csv files to csvfolder need to copy all json files to json folder Code is below to get all the files from commonfolder How to copy after that import boto3 s3 = boto3.client('s3') def lambda_handler(event, context): #List all the bucket names response = s3.list_buckets() for bucket in response['Buckets']: print (bucket) print(f'{bucket["Name"]}') #Get the files of