Judi
Judi

Reputation: 922

How to customize EC2 instance in Elastic Beanstalk Environment

I have a working Elastic Beanstalk environment(PHP 7.3).

The ec2 uses Amazon linux2.
I now have to run some userdata ( yum install ... , curl ...) on these ec2 before they start. 
Is this possible ?
I wish userdata was included in Launch configuration. 

Can any provide some guidance here. Just as an FYI, I am using cloudformation.

Thanks !

Upvotes: 1

Views: 605

Answers (1)

Marcin
Marcin

Reputation: 238957

You can't directly modify UserData that EB is using on its instances, as the UserData is constructed by the EB service based on your setup. You can access it and view it, but can't modify from the CloudFormation level.

There are few options that could potentially server your purpose, depending on your exact needs:

  1. User Resources section in your .ebextensions to add CloudFormation code to the template that EB is generating.

  2. Create custom AMI to use in place of those provided by EB. This way you can set them up and fine tune to your requirements.

  3. Use .ebextensions and platform hooks to install extra software or curl webservices you need.

Hope this helps.

Upvotes: 1

Related Questions