Hot answers tagged

13

You need to allow to list bucket location. Also, I'm not confident if you'd be able to upload and delete objects from the bucket with that policy. I'd go with: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListAllMyBuckets" ], "Resource": "*" }, { "Effect": "...


12

I'm running Amazon S3+CloudFront on several of my sites. There's not really much to it, Craft makes it really easy: Create a new Amazon S3 assets source in Craft. Set up CloudFront in AWS (see this link). In the settings for your assets source, add your cloudfront url (something like http://xxxxxxxxx.cloudfront.net/, or your custom CNAME if you set one up) ...


12

There are a few regions that support only S3's v4 of signing requests without the possibility of falling back to v2. The S3 library that Craft 2 uses only supports S3 v2. Check this table for reference - if it says "Version 4 only" in the last column then that region can't be used in Craft 2. We're not switching out that library in Craft 2.x, but it won't ...


9

It's not a log per se, but you can check out the craft_assetindexdata table of your database. That will show you all of the assets which Craft has indexed. You can see how far Craft has gotten by taking a look at the recordId column - all of the already indexed entries are going to have a value in that column while the records still waiting to be indexed ...


6

Private buckets can be used, but files uploaded to them via the Craft CP will be given public read access. Expiring URLs are not built into Craft because the files being public.


6

I was under impression that it was a bucket setting, but after doing some reading, it seems that this is a per-object setting and should be performed while uploading to a bucket. I'll add this to the list and you can expect to see this in Craft 2.2!


6

Yes you can. Just remember to add your new Assets folder as an assets source to your old Asset fields (fields that are "Asset" types) so users still can add/edit/change their assets.


5

This question is really more about S3 than about Craft. What you need for the assets is not the file path, but the url. And yes, S3 assets do have a url. This page describes the format for the host: <bucket-name>.s3-website-<AWS-region>.amazonaws.com They give these examples: This URL requests the photo.jpg object, which is stored at the ...


5

Entirely possible. There is some discussion of having Craft installed in a load-balanced environment here. You'll want to have CRAFT_STORAGE_PATH point to a shared file system for all servers. If you have sticky sessions enabled at a load-balancer level, then PHP sessions won't be a problem. If not, then you'll want to set overridePhpSessionLocation to ...


5

Unfortunately, this isn't currently possible. This feature request is very similar to what you're requesting... however, it would still require that all of your environments use the same type of asset source.


5

Your SVG file is probably missing the the XML declaration at the top (<?xml version="1.0" encoding="UTF-8"?>). PHP's FileInfo detects XML files (which SVG is) without that declaration as text/html files. Lots of SVG editors/exporters will (annoyingly) omit that.


5

The problem was that Frankfurt and London are not currently supported S3 bucket locations in Craft CMS v2.6.2956. Switching to Ireland solved my issue.


4

From the docs, environment variables are currently only parsed in 3 places in the control panel. File System Path (in asset source settings) URL (in asset source settings) Site URL (in Settings → General) So they won't work in the "subfolder" setting. You can add a feature request if you think that should change.


4

I agree with Brad's comment, this is very similar to those two other threads. That being said, here is an important quote which is buried on one of those threads... When an image is first uploaded, Craft will "sanitize" the image for any malicious code by re-saving the image out to a new file. It jumps through some pretty significant to ensure that the ...


4

S3 is not itself a CDN, no. However, you can use Cloudflare as a free and very easy to set up CDN service in front of it. For me the main advantages of S3 are that it's a centralised repository of assets I can point all my environments to (so dev, staging, production all point to the same S3 and thus have identical assets available to them with no need to ...


3

The problem ended up being that I had completely missed the location setting in the database column of the Asset source.


3

I did end up opening a support ticket with Craft- they immediately suggested that this could be caused by a firewall. To which I scoffed! But after talking with some other folks in the office, this seems to be the case. Unfortunately we never found a firewall solution to this problem. What did work was to assign a static IP to my computer that bypasses the ...


3

Craft 3 Update This is currently possible in Craft 3. Install the AWS S3 plugin from the Plugin Store. Make sure you're running Craft Pro. Create a new Asset Volume using S3. Go to Settings->Users->Settings in the Control Panel and set the "User Photo Location" setting to your S3 volume. Craft 2 Currently no, although this is likely to change in the ...


3

This is definitely possible in Craft PRO -- I just tested with fine results (latest ver. 2.4.2670). So I would look at your IAM policy. If you have your policy statement scoped to the one bucket in question (and not to all buckets in your account), you could use some wildcard permissions for your main actions, like this, and I think you should be able to ...


3

The bucket you're trying to list is probably in the Frankfurt S3 region. The 3rd party library used in Craft 2.x for Amazon S3 support does not support Signature Version 4 that Frankfurt region requires, so you won't be able to use buckets in that region, as outlined in this answer Craft 3.0 will not have this limitation, however.


3

Yes that’s all you need to do. It also works the same if moving to/from a local directory or Google Cloud Storage, or even a subdirectory of any volume type. The index of file paths is relative to the root of the volume for the source, so if the volume changes it doesn’t matter.


3

I'd recommend updating the asset indexes via Utilities → Asset Indexes (or Settings → Update Asset Indexes if you're on Craft 2) in your Control Panel.


2

Currently not, but there probably should be. There is already a somewhat related, similar feature request here.


2

We created a plugin to help solve this problem: https://github.com/Firstborn/Craft-CMS-Environment-Settings This plugin allows you to specify different configurations per environment on a single asset source.


2

I'm no AWS expert but does your iam user have the correct access/secret keys as well? While you're at it, you might as well grant PutObject, GetObject, and DeleteObject in that policy as well so Craft has access to the objects in it. See this blog post by Amazon for a good starting point.


2

The AWS Frankfurt region (eu-central-1) does only support the "new" v4 signature. Craft 2 uses the v2 signature of the S3 API and that's not easy to fix. Ireland (eu-west-1) should be good enough in terms of latency.


2

You would need to build the complete URL to your file in order for it to work in your CSS. See this answer: Do Remote Assets (ie. S3) have file paths? If the background-image is handled by something like a single or an entry template you could handle it with an inline style tag: Regular Loading: {% set image = entry.backgroundImage.first()%} Eager-loaded:...


2

So is it a Craft trial issue? Are you allowed to connect to S3 in trial version of Craft Pro? Nope. There are no limitations when running Craft on a "non-public" domain in trial mode. However, I enter my credentials but the refresh button does not show my bucket. Check your browser's console and see if it's logging any errors. My guess is you'll see a ...


2

I found a solution that lets you overwrites the core file S3.php without touching the core files. By adding this snippet to config/general.php // S3 override const BUCKET_NAME = 'YOUR BUCKET NAME'; require_once('../craft/plugins/gm/S3.php'); return array( ... ); And duplicate the S3.php file and add it to the plugins folder you can make ...


2

Sorry, there's not a clean way of doing that in Craft 2. What you can do, though, is manually create an entry for the Asset Source in the craft_assetsources table in database. This is improved in Craft 3, so, yay!


Only top voted, non community-wiki answers of a minimum length are eligible