Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with Elastic Beanstalk, Immutable Deployments, and CloudFormation

We have just recently begun using immutable deployments with Elastic Beanstalk. To be more specific, we enabled

  • immutable application deployment and
  • immutable configuration updates.

We use CloudFormation for everything. E.g., instead of enabling immutable deployments using the UI (AWS Management Console), we added the respective OptionSettings to the ConfigurationTemplate within our configuration template.

However, we ran into some issues using this approach. Whenever we change certain properties within the ConfigurationTemplate, we get this error message:

Failed to deploy application.

Cannot update resource configuration and instance configuration simultaneously with immutable deployments. Choose a different deployment policy and redeploy to make this change.

After intensively searching the documentation, we were not able to find out exactly what changes we may do with immutable deployments, and what causes the above error. We got the error when we tried to manipulate the following OptionSettings property:

- Namespace: 'aws:autoscaling:asg'
  OptionName: MinSize
  Value: 6
- Namespace: 'aws:autoscaling:asg'
  OptionName: MaxSize
  Value: 6

We would be very thankful for anyone who could tip us off in regards to what options we might change within our CloudFormation template without causing the deployment to fail. Thank you so much!

like image 590
Dwight Schrute Avatar asked Jan 11 '18 09:01

Dwight Schrute


People also ask

How do CloudFormation and Elastic Beanstalk differ?

Both CloudFormation and Elastic Beanstalk are a way of deploying your application on AWS. But they're fundamentally different approaches. Beanstalk is PaaS (platform as a service) while CloudFormation is IaC (infrastructure as code).

What is immutable deployment in Elastic Beanstalk?

Immutable deployments perform an immutable update to launch a full set of new instances running the new version of the application in a separate Auto Scaling group, alongside the instances running the old version. Immutable deployments can prevent issues caused by partially completed rolling deployments.

When should you not use Elastic Beanstalk?

Elastic Beanstalk isn't great if you need a lot of environment variables. The simple reason is that Elastic Beanstalk has a hard limit of 4KB to store all key-value pairs. The environment had accumulated 74 environment variables — a few of them had exceedingly verbose names.

Which deployment strategy does AWS Elastic Beanstalk support?

AWS Elastic Beanstalk supports the following type of deployment strategies: All-at-Once: Performs in place deployment on all instances. Rolling: Splits the instances into batches and deploys to one batch at a time.


1 Answers

You need to set your aws:elasticbeanstalk:command DeploymentPolicy to "Rolling" or something else and push that through. Then you can change it back to Immutable once it is set to something other than the default and not Immutable.

The message means that you are not allowed to change them both to on at the same time but not that they can't be used together.

Also make sure you have aws:autoscaling:updatepolicy:rollingupdate RollingUpdateEnabled set to true plus aws:elasticbeanstalk:healthreporting:system SystemType set to "enhanced" and configure a aws:elasticbeanstalk:application Application Healthcheck URL in your app for it to health check otherwise it will fail with another misleading message.

like image 121
Matt Reed Avatar answered Nov 14 '22 20:11

Matt Reed