How to add multiple keys for elastic beanstalk instance?

NT3RP picture NT3RP · Nov 2, 2012 · Viewed 13.1k times · Source

There is a very good question on [How to] SSH to Elastic [an] Beanstalk instance, but one thing I noticed is that, through this method, it is only possible to add one SSH key.

How can I add multiple SSH keys to an instance? Is there a way to automatically add multiple keys to new instances?

Answer

rch850 picture rch850 · Nov 20, 2014

To create a file named .ebextensions/authorized_keys.config is another way to do it.

files:
  /home/ec2-user/.ssh/authorized_keys:
    mode: "000400"
    owner: ec2-user
    group: ec2-user
    content: |
      ssh-rsa AAAB3N...QcGskx keyname
      ssh-rsa BBRdt5...LguTtp another-key

The name of file authorized_keys.config is arbitrary.