forward3d/cap-ec2

Multiple AWS accounts for a single deploy

gbish opened this issue · 1 comments

gbish commented

I'm taking a bit of a wild stab here, and thinking this may be a momoization problem, but not fully sure.

The scenario:
My company developing a site for a client, where we are hosting the staging environment on our AWS account, but the production environment is in a separate AWS account.

The problem:
When I run cap staging ec2:status I get back the desired info. However, when I run cap production ec2:status I get nothing back.

To further complicate the issue, I am setting :ec2_access_key_id and :ec2_secret_access_key in the staging and production files separately, so I am not trying to use the fetch(:key, default). I have tried that technique as well, and it didn't make a difference. Either way, there should be no conflict when having the keys set this way.

To complicate this issue a bit more, if I use the access keys for the separate account, either via ENV or directly entered into the deploy.rb that server will show up when running cap production ec2:status, and obviously the staging will return nothing.

It seems that whatever I do, I can't get both servers to be available to me. This worked fine in the past, but even when reverting to older versions, I still ran into the same issue, so I'm not really sure where the issue lies.

I am currently using a 'workaround' aka an if statement, to set them based upon the stage being used. It's not super elegant, but it works, which is all I can ask for.

Gems of import:
Capistrano 3.4.0
cap-ec2 1.0.0

If you would like any info on config set, terminal output, other misc gems, etc, please let me know.

@gbish Have you made any progress with this issue? Curious to know where you've placed this if statement.