Open SolomonHD opened 5 years ago
Hi @SolomonHD. This gem does not manage the any credentials to access AWS. This is done directly through the AWS SDK (as you can see here: https://github.com/aws/aws-sdk-ruby#configuration).
It does not seem properly documented in the link I provided, but there's a spec that covers this functionality (https://github.com/aws/aws-sdk-ruby/blob/97b28ccf18558fc908fd56f52741cf3329de9869/gems/aws-sdk-core/spec/aws/credential_provider_chain_spec.rb#L95)
Are you sure the env var is properly set? Try doing a quick debug on it by placing this piece of code on top of the config file, just to double check:
puts ENV['AWS_PROFILE']; exit;
So when I put the line you gave me at the top of deploy.rb it did output the profile I'm using. Now when I run the describe instances command it says cap aborted application not set
This is what I currently have:
#deploy.rb
Aws.config.update({
region: 'us-east-1',
profile: ENV['AWS_PROFILE']
})
aws_ec2_register
set :aws_ec2_stage, (proc { fetch(:stage) })
lock "~> 3.11.0"
set :application, "dlp-curate"
set :repo_url, "https://github.com/emory-libraries/dlp-curate.git"
set :deploy_to, '/opt/dlp-curate'
set :rails_env, 'production'
set :assets_prefix, "#{shared_path}/public/assets"
set :aws_ec2_name_tag, 'test.solomon.com'
set :aws_ec2_contact_point, :private_ip
set :aws_ec2_roles_tag, 'web, db, app'
set :aws_ec2_application_tag, 'dlp-curate'
My current config:
#production.rb
Aws.config.update({
region: 'us-east-1',
profile: ENV['AWS_PROFILE'] || ENV['AWS_DEFAULT_PROFILE'],
})
aws_ec2_register
#set :aws_ec2_application, (proc { fetch(:application) })
#set :aws_ec2_regions, ['us-east-1']
#set :aws_ec2_stage, (proc { fetch(:stage) })
#set :aws_ec2_stage_tag, 'production'
#set :aws_ec2_contact_point, :private_ip
#set :aws_ec2_roles_tag, 'web, db, app'
set :aws_ec2_extra_filters, [
{
name: "tag:Name",
values: ["test.solomon.com"],
},
]
Also, I tested out the aws-sdk (via aws-v3.rb)
It works fine and sees my instances with the ec2.describe_instances.reservations.first.instances.first
command if I set AWS_PROFILE, it seems to ignore AWS_DEFAULT_PROFILE (as per https://github.com/aws/aws-sdk-ruby/issues/2034)
Hi, I usually use the AWS_PROFILE variable for any aws related tasks. This Capistrano plugin doesn't seem to recognize when I have a shell with the proper AWS_PROFILE loaded in. Can I have some details about how it works?
Here's what I have in our deploy/production.rb:
What I'm trying to do is deploy to an EC2 with a specific name tag. The cap production aws:ec2:instances command doesn't return any instances