0

I'm try to describe my situation:

Have multiple AWS account, credentials is located under ~/.aws/credential To swich to other account I'm typing:

eb init -i --profile name

Now to deploy code to accounts I must every time switch to other acc. How I can organize .ebextensions to have possibility to deploy to 10 AWS acc without switching between profiles ?

Wizard
  • 10,985
  • 38
  • 91
  • 165

1 Answers1

5

You don't need to do eb init every time. You can deploy with arguments, eb deploy --profile profile_name.

If you setup your .elasticbeanstalk/config file something like this you can have different profiles and branches for different environments without using arguments.

branch-defaults:
  develop:
    environment: env-develop
    profile: eb-profile
  master:
    environment: env-master
    profile: eb-profile2
global:
  application_name: env_name
  default_ec2_keyname: key_name
  default_platform: Python 2.7
  default_region: ap-southeast-1
  sc: git

I haven't tried this, but if you call eb deploy environment_name --profile eb-profile3 that is linked to somewhere else it should deploy there with your branch and global specific settings (profile overriden).

eb deploy <environment name> overrides the environment name. http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-deploy.html

I have only read this briefly, but maybe this can help you as well. http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebcli-compose.html

Gustaf
  • 1,299
  • 8
  • 16
  • But I need 10 times write run `eb deploy` no solution with single command deploy to 10 profiles ? – Wizard May 11 '16 at 06:18
  • Just write a quick lite script for it with eb deploy 10 times in. Or look into composed environments, not sure if that works though. – Gustaf May 11 '16 at 06:28
  • 2
    You can also script the AWS CLI, or use their SDK to fully automate deployment. – Tony Chiboucas May 13 '16 at 01:37
  • @TonyChiboucas yes sure, but a bit strange that so much popular cloud not have for that solutions ... – Wizard May 24 '16 at 07:30
  • 2
    @Wizard once you get into automating changing deployment/environment/configuration across multiple instances, no two solutions will need the same process. For you, in your situation, it may seem like it would just make sense to have this be built into a single command. However, your particular scenario is not actually very common. This is exactly why the AWS CLI is built to be scripted, so that such processes and situations CAN be automated and tailored to fit any need. – Tony Chiboucas May 24 '16 at 17:42
  • 1
    I don't see how this allows you to deploy to multiple applications. Sure, it obviously handles multiple environments, and multiple accounts. But where are the multiple applications? It looks like you've hardcoded a global `application_name: env_name`, which would imply you're only deploying to a single application. – Resigned June 2023 Aug 09 '17 at 19:20
  • @RadonRosborough You can set your profiles to be linked to separate AWS accounts, which would be different applications even if it they have the same name, which was what was requested. – Gustaf Aug 17 '17 at 01:24
  • 1
    @Gustaf Indeed that was what was requested. It looks like I read the title of the question and failed to read the body. – Resigned June 2023 Aug 17 '17 at 02:16