Reputation: 1038
I'm currently preparing to leverage the features of AWS more, still a few questions arose during my research. I'm currently interested in a combination of AWS autoscaling with multiple auto scale groups (one for each service) as well as deployment with AWS code deploy.
I'm wondering what are common practices to configure the EC2 instance which will get spun up when AWS notices that I need a new EC2 instance. I thought about creating a custom AMI where everything is installed that I need for the application to run. Are there other possibilities? How would something like Ansible play into in this setup? Also, what if I need to change the instances like install a security update, what is a common practice to do so without sshing to each server instance and doing it manually.
Thanks
Upvotes: 0
Views: 704
Reputation: 1151
First of all if you were looking for Provisioning Automation
of AWS infra, then go through Ansible
, CloudFormation
and Terraform
, choice is yours.
You can prepare GoldenImage
with all required packages, tools, security configs installed within it. After that you can create Launch Configuration
for Auto Scaling Group
, within the launch configuration, you can also provide your custom startup scripts
.
Afterworld, if for any ad-hoc
task or command execution, ansible
is best choice.
Upvotes: 0
Reputation: 269091
There are basically two choices for configuring an Amazon EC2 instance that is created using Auto Scaling:
You could also use a combination of the two -- have most of it configured on an AMI, then do the final configuration via User Data.
Tools like Puppet, Chef and Ansible are also popular. They are triggered via User Data script, that then runs Puppet/Chef/Ansible to install software on the instance.
The benefit of using a fully-configured AMI is that the instance is available more quickly, which is handy in an auto-scaling situation where you need more capacity fast. The downside is that you must create a new AMI whenever the software has been updated. Netflix have automated this process with Aminator, which automatically builds a new AMI when software is updated.
The benefit of using a User Data script is that the configuration is fully flexible and you do not need to maintain a library of AMIs.
Upvotes: 2
Reputation: 781
try to add bootscript during autoscale configuration.
Upvotes: 0