Python Forum

Full Version: help me with python script for AWS S3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In detail: when a file is uploaded via FTP to an FTP server in the one region, the data providers will move the file, causing an i_notify event. cron should handle this event and kick off a script that will upload this file to the S_3 bucket in the other region... Upload this file to the bucket using the accelerated endpoint and using multi part uploads.
You forgot one detail... what is your question? Post the code you've written so far as well as the full Traceback if your code fails.
i want to write a script that will be called by incron to upload files to the S3 bucket in the "other region" when the data files are moved. In detail: when a file is uploaded via FTP to an FTP server in the Ireland region, the file will move , causing an inotify event. Incron should handle this event and kick off a script that will upload this file to the S3 bucket in the us-east-1 bucket. Upload this file to the bucket using the accelerated endpoint  and using multipart uploads...
i wrote this much code for this..but i dont have any idea about incron and script is also not completed ... plz guide me through this.
i am posting screenshot of my code in attachment..and here too 

import os, sys

import boto3

client = boto3.client('s3')

def accelarationBucket():

    response = client.put_bucket_accelerate_configuration(

     Bucket=' mybucketname',

     AccelerateConfiguration={'Status': 'Enabled'}

    )

def creatMultipartUpload():    

    response = client.create_multipart_upload(

     Bucket='twc-ecmwf-data-eu-west-1',

     key='first'

    )


    response = client.complete_multipart_upload(

     Bucket='twc-ecmwf-data-eu-west-1',

     Key='first',

     UploadId=''

    )

def rsyncBucket():

    boto-rsync s3://twc-ecmwf-data-eu-west-1  s3://twc-ecmwf-data-us-east-1 

accelarationBucket()

creatMultipartUpload()
rsyncBucket()
İmage
Could you elaborate on your question? You're more likely to get a reply that why, since it's harder for would-be answerers to try to figure out the question by reading your code and seeing what it does/doesn't do relative to your description of what you ultimately want.
(Oct-20-2016, 10:48 AM)DDPYTHON Wrote: [ -> ]In detail: when a file is uploaded via FTP to an FTP server in the one region, the data providers will move the file, causing an i_notify event. cron should handle this event and kick off a script that will upload this file to the S_3 bucket in the other region... Upload this file to the bucket using the accelerated endpoint and using multi part uploads.

That sounds like it was copy-pasted from a homework assignment.
Merged threads, keep that in mind while trying to read the flow above!