Cloud-based licensing works a bit differently than licenses used in an on-premises installation.
Optimizely Content Management System (CMS) licenses are available from the [Optimizely license portal](🔗). As cloud-based environments could dynamically scale out and in again depending on traffic volume, the usage is based on number of running instances.
**Instance Bound** ("cloud licenses") used for cloud environments are tied to the number of running instances, with the necessary flexibility to operate on Azure or Amazon commercial clouds.
An instance bound license can be seen as an on-premises server license based on a _floating number of instances_. A cloud-based site will "call home" when activated to register its running web app instance.
## License setup and activation
This section describes how to activate instance-bound licenses to be used with environments running in Microsoft Azure.
If you are using Optimizely Digital Experience Platform (DXP), this is not needed, because DXP has no instance validation and does not require manual activation.
### Define the URLs
In the following scenario, a CMS solution is running in two environments: one for test and one for production. You can use the same instance-bound license file for both environments. To avoid a license error, you need to define the same URL in both the test and production environments.
For each environment, go to the CMS admin view, and add the URL to be used.
### Activate the license
For each environment, go to the CMS admin view, and activate the license on both the test and production environments. The running instances are counted towards the total number of instances allowed by the license.
## Behind a firewall
Behind a firewall, open communication with the licensing service on **port 443 (SSL)** for _cloud-api.episerver.com_.
## Optimize license usage
The section describes how the instance counting works, and provides some practical guidelines for optimizing cloud-based licenses when used with [Microsoft Azure](🔗).
### Instance counting
Because the cloud license is a _floating_ license, you can add and remove instances as needed for the traffic volume, as long as you do not exceed the total number of instances allowed by your license.
Instance counting is connected to the Azure server name. When scaling out, it does not matter how many web apps and deployment slots (see below) you have, because they share the same instances (servers). Only ensure that you are using an [Azure App Service Plan](🔗) that does not allow for more instances than the number of instances in your license.
If you use the same license in multiple Azure App Service Plans, (for example, to separate test and production environments), then the license has to support the combined number of instances.
### Use deployment slots
A slot is an Azure feature to help avoid "cold starts" after deployment. Using slots, you can deploy a new version of your solution to a [Web App staging slot](🔗), where the site is automatically warmed up. When completed, Azure swaps to the live environment. Optimizely supports deployments slots both technically and from a license perspective.
If you use the same database (in production) for a staging slot, you could unintentionally upgrade the Optimizely database version when deploying new code to it. The Optimizely-database-version would then be out of sync with the Optimizely-code-version running in production, causing an error in production.
### Exceed the instance limit
During a scale-up or a system upgrade, environments may temporarily be doubled, causing the instance limit to be exceeded. If this happens, an information notification appears in the edit view of the site. The front-end part will still be functional, and the operation of the site will not be interrupted. The notification disappears when the number of running instances reach an approved level. The message is also displayed if the communication to the Optimizely back-end is lost.
### Switch between production and developer licenses
When updating your developer environment and restoring a database on a production database, you may receive a notification stating that you do not have an active license. This is most likely due to the production database being activated on a production license, whereas you are using a developer license in your development environment. The solution is to manually reactivate the license.