Posts

Showing posts with the label amazon-s3

access amazon s3 bucket without region end point

Image
Clash Royale CLAN TAG #URR8PPP access amazon s3 bucket without region end point Currently, I am accessing Amazon S3 using the Access key, Secret Access Key and region endpoint in Amazon S3 SDK which working fine. Like this client = new AmazonS3Client("some-access-key", "some-secret-key",Amazon.RegionEndpoint.USEast1) Is it possible to remove region endpoint because Bucket name will be one globally so why we need region endpoint? There must be some way through which we can able to get region endpoint of the bucket in Amazon S3 SDK?? or can work without region endpoint if "Yes" then How ?? if "No" then Why?? 1 Answer 1 A bucket will always have a region, when leaving it blank it will create the bucket in the US East region for you. There can be several reasons for choosing a region, from the API reference: By default, the bucket is created in the US East (N. Vi...

boto3 / s3 - how can you connect with uid/pwd in like you could previously ?

Image
Clash Royale CLAN TAG #URR8PPP boto3 / s3 - how can you connect with uid/pwd in like you could previously ? I have some code which I want to port to boto3. Previously it was possible to do this : conn = boto.connect_s3(sys.argv[1], sys.argv2) In the current documentation it's assumed that you have a config file setup with the uid/pwd in it or that you use environment variables and so there is no explicit passing of the uid/pwd when initiating a connection. Is it now impossible to to just pass in the values as per my example or is there some way I've missed in the documentation ? Thanks See: Credentials — Boto 3 Docs documentation – John Rotenstein 20 mins ago 1 Answer 1 When writing AWS Python code, the SDK can automatically find your AWS credent...

Setting Up S3 with Heroku and Django with Images

Image
Clash Royale CLAN TAG #URR8PPP Setting Up S3 with Heroku and Django with Images so I currently have my static files (js and css) just being stored on Heroku which is no biggie. However, I have objects that I need to store multiple images too and be able to get those images on request. How would I store a reference to those images? I was planning to use a S3 Direct File Upload using these steps on Heroku here. Is this also going to be the best way for me to do so? Thank you in advance. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

wordpress wp-content/uploads folder 301 redirect to S3 bucket by cloudfrond CDN by .htaccess issues

Image
Clash Royale CLAN TAG #URR8PPP wordpress wp-content/uploads folder 301 redirect to S3 bucket by cloudfrond CDN by .htaccess issues See below, the .htacess file from wordpress. If I remove the part starting from #begin Wordpress. All the image file url will be change to d28rt1vkpsdxas.cloudfront.net/someimage.png successfully. However, all the internal link will be unable to access(only the home page can access). The error is Not Found The requested URL /shop/ was not found on this server. But if I keep the part start from #begin Wordpress. The cdn redirect will not work any more. All photos are missing. Thanks in advanced. Options +FollowSymlinks RewriteEngine on Rewriterule ^wp-content/uploads/(.*)$ http://exampled28t1vkps.cloudfront.net/$1 [r=301,nc] # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END Wo...

Amazon S3 - HTTPS/SSL - Is it possible? [closed]

Image
Clash Royale CLAN TAG #URR8PPP Amazon S3 - HTTPS/SSL - Is it possible? [closed] I saw a few other questions regarding this without any real answers or information (or so it appeared). I have an image here: http://furniture.retailcatalog.us/products/2061/6262u9665.jpg Which is redirecting to: http://furniture.retailcatalog.us.s3.amazonaws.com/products/2061/6262u9665.jpg I need it to be (https): https://furniture.retailcatalog.us/products/2061/6262u9665.jpg So I installed a wildcard ssl on retailcatalog.us (we have other subdomains), but it wasn't working. I went to check https://furniture.retailcatalog.us.s3.amazonaws.com/products/2061/6262u9665.jpg And it wasn't working, which means on the Amazon S3 website itself the https wasn't working. How do I make this work? Questions on Stack Overflow are expected to relate to programming within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be r...

Iterating a list of lists within Python for aws lambda

Image
Clash Royale CLAN TAG #URR8PPP Iterating a list of lists within Python for aws lambda I have a question related to python. The use case is to write a python function (in aws lambda) which will look for a set of files in multiple buckets and return some action like creating a dummy file in s3 bucket or triggering another lambda. For eg: list1=[file1,file2,file3] list2=[file4,file5,file6] list3=[f7,f8,f9] def lambda_handler(event,context): if len(list1)==9: print("something") //create dummy file in s3 OR, trigger another lambda elif len(list2)==9: print("Something") else: print("all files are not available") and like wise. I am a bit confused about how to do iteration within the 3lists and trigger one lambda for one set of file say list1 or list2 or list3. Or alternatively I can create a dummy file in s3. Can anyone please help me with the way to do it? Could you please clarify your question? Are you asking how to w...

Error while pushing all *.gz files to aws s3 bucket - “bash: -c: line 0: syntax error near unexpected token `then'”

Image
Clash Royale CLAN TAG #URR8PPP Error while pushing all *.gz files to aws s3 bucket - “bash: -c: line 0: syntax error near unexpected token `then'” I am trying to push all *.gz files to aws s3 bucket but I getting this error bash: -c: line 0: syntax error near unexpected token `then' ssh root@ "find /tmp/ -name "localhost_*.gz" -mtime -1 -exec s3cmd put '{}' s3://script-testing/test1/ ; if [ $? == "0" ] ; then echo "Successfully pushed the backup to s3 bucket" | mail -s "Successfully pushed backup to S3 " email-id; else echo "Failed pushing logs to S3 Bucket" | mail -s "Failed Pushing logs to s3" email-id; fi" I checked syntax in shellcheck.net. It looks all good. But I don't know where is the issue. Any help would be greatful. – saranjeet singh Mar 7 '14 at 21:58 ...