Using the eb
CLI, one can enable SSH through eb ssh
. This recreates all instances, and I'm assuming it updates the security group ingress rules & adds the correct keys to the instances.
How can one programmatically achieve this (terraform, pulumi, CF ... - I am using Pulumi but any will do) ?
Asked
Active
Viewed 202 times
-1

Ulysse Mizrahi
- 681
- 7
- 19
1 Answers
0
In CloudFormation, for example, in your AWS::ElasticBeanstalk::ConfigurationTemplate you can use OptionSettings to provide EC2KeyName
.
For instance;
Resources:
MyConfingTemplate:
Type: AWS::ElasticBeanstalk::ConfigurationTemplate
Properties:
ApplicationName: YourApplicationName
OptionSettings:
- Namespace: aws:autoscaling:launchconfiguration
OptionName: EC2KeyName
Value: <key-pair-name>
SolutionStackName: 64bit Amazon Linux 2 v3.1.0 running Python 3.7
You don't have to modify security groups. They will automatically allow ssh.

Marcin
- 215,873
- 14
- 235
- 294