amazon-s3

How can my s3 bucket host multiple websites in different folders using nginx?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-14 04:54:07
问题 I have an s3+Cloudfront solution on Amazon. I would like to host different websites in different folders inside the bucket and access them in one of this two way: - a subdomain -> mywebsite1.mydomain.com or - path -> www.mydomain.com/mywebsite1 I read that a proxy based on nginx could solve my problems. Is it true? Is it possible to get nginx on s3? 回答1: You can do this with Nginx (or HAProxy) running in EC2 and acting as a reverse proxy in front of the buckets, yes, but if you are not

Why doesn't Django serialize FileField to the file url when using AWS S3

雨燕双飞 提交于 2020-01-14 03:52:30
问题 Scenario: I'm using Amazon S3 as default storage using S3 Boto and all files would be going to 'media' folder in my bucket. Question: When I am serializing the model containing my FileField to json using serializers.serialize , all I get in the json is 'media/abc.png' or something of that sort. Is there a way to automatically get the file url in json instead of the relative path or should I manually append the url into the json response every time? 回答1: Django operates with File objects,

Ruby on Rails AWS S3 Download URL

…衆ロ難τιáo~ 提交于 2020-01-14 03:32:08
问题 How can I form a url link for a user so that when the user clicks on the link, it forces them to download the AWS S3 object? I've seen these two solutions: Using send_file to download a file from Amazon S3? and Using send_file to download a file from Amazon S3? however, they seem to reference an old AWS S3 v1 SDK and there does not seem to be a url_for in the v2 AWS S3 SDK. Thanks. 回答1: Ended up using the following code snippet to solve. Hope this helps others. presigner = Aws::S3::Presigner

How to solve “x-cache: Error from cloudfront” on SPA

倖福魔咒の 提交于 2020-01-14 03:17:30
问题 We are having issues trying to make working a SPA with a client router (react router). We are using the concept of have a DOMAIN -> CDN (CloudFront) -> S3 for serving our static files. We have configured the S3 for serving static files. The CDN are configured to have the origin from the S3 and we have configured custom error pages to catch errors: with this configuration we can catch errors like this: https://www.example.com/custom-url The CDN will redirect all the 404/403 errors to the main

Amazon CloudFront - protect video with Signed URL

我的梦境 提交于 2020-01-14 02:51:09
问题 BACKGROUND: Amazon Cloudfront video delivery with S3 storage: I am using a custom 360-degree video player. The player simply links to MP4 videos. The videos are not streamed but just a direct link with progressive download. ISSUE TO SOLVE ---> Signed URL 1) The videos should ONLY play back from my website and not from other websites. Otherwise someone will just hotlink to the videofiles, and I will have to pay for the Amazon traffic. 2) Where and how to insert CloudFront "Signed URL" policies

Carrierwave Rails 3 S3, save the file size to the database

不羁岁月 提交于 2020-01-13 19:55:47
问题 Using Carrierwave with Rails 3.2.6. All fine, except I need to sort a table where some attachments are displayed by file size. I'm using S3 for storage with fog. Let's say I have a Carrierwave showing like this: <%= @project.attachment %> I am able to show the size of the file by using '.size' after the field name: <%= @project.attachment.size %> shows the file size in bytes, but as I need to use an order clause when getting the records from the database, I cannot sort on this. Is there any

Carrierwave Rails 3 S3, save the file size to the database

孤人 提交于 2020-01-13 19:55:06
问题 Using Carrierwave with Rails 3.2.6. All fine, except I need to sort a table where some attachments are displayed by file size. I'm using S3 for storage with fog. Let's say I have a Carrierwave showing like this: <%= @project.attachment %> I am able to show the size of the file by using '.size' after the field name: <%= @project.attachment.size %> shows the file size in bytes, but as I need to use an order clause when getting the records from the database, I cannot sort on this. Is there any

Configuring AWS S3 Client in .NET Core

别等时光非礼了梦想. 提交于 2020-01-13 18:11:30
问题 I'm following this guide on configuring the AWS SDK in .NET Core to upload a file to an S3 bucket. My app.settings.json file contains this: { "AWS": { "Region": "us-west-1", "AccessKey": "access_key", "SecretKey": "secret_key" } ... } Here is my StartUp class: public class Startup { public IContainer ApplicationContainer { get; private set; } public IConfiguration Configuration { get; } public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env

Configuring AWS S3 Client in .NET Core

孤者浪人 提交于 2020-01-13 18:11:10
问题 I'm following this guide on configuring the AWS SDK in .NET Core to upload a file to an S3 bucket. My app.settings.json file contains this: { "AWS": { "Region": "us-west-1", "AccessKey": "access_key", "SecretKey": "secret_key" } ... } Here is my StartUp class: public class Startup { public IContainer ApplicationContainer { get; private set; } public IConfiguration Configuration { get; } public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env

Configuring AWS S3 Client in .NET Core

ε祈祈猫儿з 提交于 2020-01-13 18:11:05
问题 I'm following this guide on configuring the AWS SDK in .NET Core to upload a file to an S3 bucket. My app.settings.json file contains this: { "AWS": { "Region": "us-west-1", "AccessKey": "access_key", "SecretKey": "secret_key" } ... } Here is my StartUp class: public class Startup { public IContainer ApplicationContainer { get; private set; } public IConfiguration Configuration { get; } public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env