# Configure Worker Parameters

## Stop Running Computations

To ensure a smooth upgrade, before you start to update your Code Ocean application stack, you need to make sure there are no computations running.

Using AWS Session Manager, connect to Code Ocean services instance:

![](https://1319821714-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MO74Ph1wHV3oYY-yd18%2F-MhIWYKWnILKkCRzs5JT%2F-MhIrowvZGNw5JEKA7fZ%2FScreenshot%202021-08-17%20at%2012.28.26.png?alt=media\&token=a0fe77d6-85bd-423e-93ca-1a034032b438)

Run the following command to stop computations:

```
curl -v -X POST localhost:8300/cancel_computations
```

Wait until all computations complete by waiting until the following CloudWatch metric reaches 0: `CloudWatch > Metrics > CodeOcean > AutoScalingGroupName > SlotsUtilization`

## Remove scale-in Protection from Code Ocean Worker EC2 Instances

The upgrade waits for existing running workers to terminate before continuing. If you have verified that there are no running computations in the previous step, you can safely remove the scale in protection from the workers in the auto scaling group. This will complete the upgrade quicker.

In the AWS EC2 console go to `EC2 > Auto Scaling Groups > workers-[id]-asg > Instance Management`, then select all instances and click `Actions > Remove scale-in protection`

In `EC2 > Auto Scaling Groups > workers-[id]-asg > Details` reduce the Desired capacity to 0.

## Configuring

### Step 1 - Update the CloudFormation stack

Upgrading Code Ocean is done by updating the CloudFormation stack you've [created upon deployment](https://docs.codeocean.com/admin-guide/v2.4/deployment-guide/cloudformation-deployment#create-cloudformation-stack)&#x20;

![](https://1319821714-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI5oWfU2XlC9H7TXnXBA2%2Fuploads%2FRzrzRTadvo8CuMrp9NsK%2Fimage.png?alt=media\&token=7f926ca4-4dbe-421e-845c-9239cc3e0ffe)

### Step 2 - Specify the template

1. Choose **Use current template** in the **Prerequisite - Prepare template** window.
2. Click **Next**.&#x20;

![](https://1319821714-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI5oWfU2XlC9H7TXnXBA2%2Fuploads%2FYF3HuhaJdqVY3JtHferA%2Fimage.png?alt=media\&token=92b8df74-7c90-4698-bd45-9f511a634f65)

### Step 3 - Configuring Parameters

You can specify tags (key-value pairs) for resources in your stack and set advanced options.&#x20;

[see Deployment Parameters page](https://docs.codeocean.com/admin-guide/v2.4/deployment-guide/deployment-parameters)

Click **Next**.
