Reputation: 2450
Using Fog w/ AWS instance profiles and after 3 day my s3 urls are no longer working. I'm getting fresh urls, but the error returned from AWS is The provided token has expired. Restarting the application gets everything working again, but no errors other than the one from AWS are present.
I have read that switching to keys should fix my issue, but I was hoping to keep my iam profile. Has anyone run into this?
my Carrierwave config is bellow and I am using Carrierwave version 0.9.0 and Fog 1.28.0
CarrierWave.configure do |config|
fog_credentials = {
:provider => 'AWS',
:region => 'us-east-1',
:path_style => true,
:host => 's3-external-1.amazonaws.com' # routes all requests to Northern Virginia datacenter
}
if defined?(Settings.use_iam_profile) && Settings.use_iam_profile
fog_credentials[:use_iam_profile] = true
else
fog_credentials[:aws_access_key_id] = Settings.s3_access_key
fog_credentials[:aws_secret_access_key] = Settings.s3_secret_key
end
config.fog_credentials = fog_credentials
config.fog_directory = Settings.s3_bucket_name # required
config.fog_public = false # optional, defaults to true
config.root = File.join(Rails.root, 'private')
end
Upvotes: 2
Views: 1024
Reputation: 2450
So this link got updated, basically the issue was While the signing token was being refreshed correctly when downloading files with fog, it wasn't being refreshed when signing an S3 URL.
There was a pull request made on fog to fix this issue
Upvotes: 1