2

I'm currently trying to configure Magento 2.4.3 with AWS s3 for storing media. The guide on the Magento website is lacking in a lot of detail, I think. For example, it implies you can use AWS IAM to configure s3 storage and not require the use of the ngx_aws_auth module, which seems it's no longer developed. However, there's nothing telling you how to do this.

Has anyone successfully managed to configure the native aws-s3 storage along with nginx? I'm getting random errors such as being shown the 503 error page, with Magento thinking it's in maintenance mode for some reason (the flag isn't there, removing the relevant aws-s3 section from env.php removes the issue).

If anyone has a guide they can point me to, or walk through the steps they've taken, that would be appreciated.

1 Answer 1

2

I have tested with a CloudFront URL in front of my S3.

  1. Disable DB storage (disabled by default)
magento config:set system/media_storage_configuration/media_database 0
  1. Configure AWS-S3
magento setup:config:set \
    --remote-storage-driver="aws-s3" \
    --remote-storage-bucket="UNIQUE-BUCKET-NAME" \
    --remote-storage-prefix="myPREFIX" \
    --remote-storage-region="me-south-X" \
    --remote-storage-key="REMOTE_STORAGE_KEY" \
    --remote-storage-secret="REMOTE_STORAGE_SECRET"
  1. Configure CDN URL
magento config:set web/unsecure/base_media_url "https://WHATEVER.cloudfront.net/myPREFIX/media/"
magento config:set web/secure/base_media_url "https://WHATEVER.cloudfront.net/myPREFIX/media/"
  1. Migrate Content (in 2.4.3, you can only run this once!)
magento remote-storage:sync
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.