LoginSignup
8
8

More than 5 years have passed since last update.

Elastic Beanstalkで安全なsshを設定する

Last updated at Posted at 2015-11-08
  • Elastic Beanstalkでは、インスタンス起動時に自動的に生成され紐付けられるSecurityGroupがある
  • このSecurityGroupではまず80番ポートがSource any(0.0.0.0/0)で開放されており
  • さらにkeypairを設定するとさらにssh(22)番ポートがSource anyで開放されるルールが自動的に付与されてしまう。
    • アクセス元を制限したい(bastion経由onlyなど)

次のようにすると対策できる

  1. Environmentを作るときにkeypairをセットしない
  2. 起動時に.ebextensionsでkeypairをセットする
  3. 自分で指定するSecurityGroupの方で、sshに関する許可ルールを記述する

2. 起動時に.ebextensionsでkeypairをセットする

  • hoge の部分は自分のkeypair に置き換え。
.ebextensions/00_set_keypair.config
option_settings:
  - namespace: aws:cloudformation:template:resource:property
    resource_name: AWSEBAutoScalingLaunchConfiguration
    option_name: KeyName
    value: hoge

なお、オフィシャルでみても、aws:autoscaling:launchconfigurationで設定できる、と書いてあるんだけど、何回やってもダメだった。

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8