

# Working with custom engine versions for RDS Custom for SQL Server
<a name="custom-cev-sqlserver"></a>

A *custom engine version (CEV)* for RDS Custom for SQL Server is an Amazon Machine Image (AMI) that includes Microsoft SQL Server.

**The basic steps of the CEV workflow are as follows:**

1. Choose an AWS EC2 Windows AMI to use as a base image for a CEV. You have the option to use pre-installed Microsoft SQL Server, or bring your own media to install SQL Server yourself.

1. Install other software on the operating system (OS) and customize the configuration of the OS and SQL Server to meet your enterprise needs.

1. Save the AMI as a golden image

1. Create a custom engine version (CEV) from your golden image.

1. Create new RDS Custom for SQL Server DB instances by using your CEV.

Amazon RDS then manages these DB instances for you.

A CEV allows you to maintain your preferred baseline configuration of the OS and database. Using a CEV ensures that the host configuration, such as any third-party agent installation or other OS customizations, are persisted on RDS Custom for SQL Server DB instances. With a CEV, you can quickly deploy fleets of RDS Custom for SQL Server DB instances with the same configuration.

**Topics**
+ [Preparing to create a CEV for RDS Custom for SQL Server](custom-cev-sqlserver.preparing.md)
+ [Creating a CEV for RDS Custom for SQL Server](custom-cev-sqlserver.create.md)
+ [Modifying a CEV for RDS Custom for SQL Server](custom-cev-sqlserver-modifying.md)
+ [Viewing CEV details for Amazon RDS Custom for SQL Server](custom-viewing-sqlserver.md)
+ [Deleting a CEV for RDS Custom for SQL Server](custom-cev-sqlserver-deleting.md)

# Preparing to create a CEV for RDS Custom for SQL Server
<a name="custom-cev-sqlserver.preparing"></a>

You can create a CEV using an Amazon Machine Image (AMI) that contains pre-installed, License Included (LI) Microsoft SQL Server, or with an AMI on which you install your own SQL Server installation media (BYOM).

## Preparing a CEV
<a name="custom-cev-sqlserver.preparing.types"></a>

Use the following procedures to create a CEV using Bring Your Own Media (BYOM) or pre-installed Microsoft SQL Server (LI).

### Preparing a CEV using Bring Your Own Media (BYOM)
<a name="custom-cev-sqlserver.preparing.byom"></a>

The following steps use an AMI with **Windows Server 2019 Base** as an example.

**To create a CEV using BYOM**

1. On the Amazon EC2 console, choose **Launch Instance**.

1. For **Name**, enter the name of the instance.

1. Under Quick Start, choose **Windows**.

1. Choose **Microsoft Windows Server 2019 Base**.

1. Choose an appropriate instance type, key pair, network and storage settings, and launch the instance.

1. After launching or creating the EC2 instance, ensure the correct Windows AMI was selected from Step 4:

   1. Select the EC2 instance in the Amazon EC2 console.

   1. In the **Details** section, check the **Usage operation** and ensure that it is set to **RunInstances:0002**.  
![\[Windows AMI using RunInstances:0002 for BYOM.\]](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/images/cev-sqlserver-byom-ec2runinstances.png)

1. Log in to the EC2 instance and copy your SQL Server installation media to it.
**Note**  
If you're building a CEV using SQL Server Developer edition, you may need to obtain the installation media using your [Microsoft Visual Studio subscription](https://my.visualstudio.com/Downloads?q=sqlserver%20developer).

1. Install SQL Server. Make sure that you do the following:

   1. Review [Requirements for BYOM for RDS Custom for SQL Server](custom-sqlserver.byom.md#custom-sqlserver.byom.requirements) and [Version support for RDS Custom for SQL Server CEVs](#custom-cev-sqlserver.preparing.VersionSupport).

   1. Set the instance root directory to the default `C:\Program Files\Microsoft SQL Server\`. Don't change this directory.

   1. Set the SQL Server Database Engine Account Name to either `NT Service\MSSQLSERVER` or `NT AUTHORITY\NETWORK SERVICE`.

   1. Set the SQL Server Startup mode to **Manual**.

   1. Choose SQL Server Authentication mode as **Mixed**.

   1. Leave the current settings for the default Data directories and TempDB locations.

1. Grant the SQL Server sysadmin (SA) server role privilege to `NT AUTHORITY\SYSTEM`:

   ```
   1. USE [master]
   2. GO
   3. EXEC master..sp_addsrvrolemember @loginame = N'NT AUTHORITY\SYSTEM' , @rolename = N'sysadmin'
   4. GO
   ```

1. Install additional software or customize the OS and database configuration to meet your requirements.

1. Run Sysprep on the EC2 instance. For more information, see [Create an Amazon EC2 AMI using Windows Sysprep](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-create-win-sysprep.html).

1. Save the AMI that contains your installed SQL Server version, other software, and customizations. This will be your golden image.

1. Create a new CEV by providing the AMI ID of the image that you created. For detailed steps, see [Creating a CEV for RDS Custom for SQL Server](custom-cev-sqlserver.create.md).

1. Create a new RDS Custom for SQL Server DB instance using the CEV. For detailed steps, see [Create an RDS Custom for SQL Server DB instance from a CEV](custom-cev-sqlserver.create.md#custom-cev-sqlserver.create.newdbinstance).

### Preparing a CEV using pre-installed SQL Server (LI)
<a name="custom-cev-sqlserver.preparing.licenseincluded"></a>

The following steps to create a CEV using pre-installed Microsoft SQL Server (LI) use an AMI with **SQL Server CU20** Release number `2023.05.10` as an example. When you create a CEV, choose an AMI with the most recent release number. This ensures that you are using a supported version of Windows Server and SQL Server with the latest Cumulative Update (CU).

**To create a CEV using pre-installed Microsoft SQL Server (LI)**

1. Choose the latest available AWS EC2 Windows Amazon Machine Image (AMI) with License Included (LI) Microsoft Windows Server and SQL Server.

   1. Search for **CU20** within the [Windows AMI version history](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-ami-version-history.html).

   1. Note the Release number. For SQL Server 2019 CU20, the release number is `2023.05.10`.  
![\[AMI version history result for SQL Server 2019 CU20.\]](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/images/rds_custom_sqlserver_cev_find_ami_history_li_cu20.png)

   1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

   1. In the left navigation panel of the Amazon EC2 console choose **Images**, then **AMIs**.

   1. Choose **Public images**.

   1. Enter `2023.05.10` into the search box. A list of AMIs appears.

   1. Enter `Windows_Server-2019-English-Full-SQL_2019` into the search box to filter the results. The following results should appear.  
![\[Supported AMIs using SQL Server 2019 CU20.\]](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/images/rds_custom_sqlserver_cev_find_ami_li_cu.png)

   1. Choose the AMI with the SQL Server edition that you want to use.

1. Create or launch an EC2 instance from your chosen AMI.

1. Log in to the EC2 instance and install additional software or customize the OS and database configuration to meet your requirements.

1. Run Sysprep on the EC2 instance. For more information prepping an AMI using Sysprep, see [Create a standardized Amazon Machine Image (AMI) using Sysprep](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/Creating_EBSbacked_WinAMI.html#sysprep-using-ec2launchv2).

1. Save the AMI that contains your installed SQL Server version, other software, and customizations. This will be your golden image.

1. Create a new CEV by providing the AMI ID of the image that you created. For detailed steps on creating a CEV, see [Creating a CEV for RDS Custom for SQL Server](custom-cev-sqlserver.create.md).

1. Create a new RDS Custom for SQL Server DB instance using the CEV. For detailed steps, see [Create an RDS Custom for SQL Server DB instance from a CEV](custom-cev-sqlserver.create.md#custom-cev-sqlserver.create.newdbinstance).

## Region availability for RDS Custom for SQL Server CEVs
<a name="custom-cev-sqlserver.preparing.RegionVersionAvailability"></a>

Custom engine version (CEV) support for RDS Custom for SQL Server is available in the following AWS Regions:
+ US East (Ohio)
+ US East (N. Virginia)
+ US West (Oregon)
+ US West (N. California)
+ Asia Pacific (Mumbai)
+ Asia Pacific (Osaka)
+ Asia Pacific (Seoul)
+ Asia Pacific (Singapore)
+ Asia Pacific (Sydney)
+ Asia Pacific (Tokyo)
+ Canada (Central)
+ Europe (Frankfurt)
+ Europe (Ireland)
+ Europe (London)
+ Europe (Paris)
+ Europe (Stockholm)
+ South America (São Paulo)

## Version support for RDS Custom for SQL Server CEVs
<a name="custom-cev-sqlserver.preparing.VersionSupport"></a>

CEV creation for RDS Custom for SQL Server is supported for the following AWS EC2 Windows AMIs:
+ For CEVs using pre-installed media, AWS EC2 Windows AMIs with License Included (LI) Microsoft Windows Server 2019 (OS) and SQL Server 2022 or 2019
+ For CEVs using bring your own media (BYOM), AWS EC2 Windows AMIs with Microsoft Windows Server 2019 (OS)

CEV creation for RDS Custom for SQL Server is supported for the following operating system (OS) and database editions:
+ For CEVs using pre-installed media:
  + SQL Server 2022 Enterprise, Standard, or Web, with CU9, CU13, CU14-GDR, CU15-GDR, CU16, CU17, CU18, CU19, CU19-GDR, CU20-GDR, CU21-GDR, CU22, CU22-GDR, CU23 and CU23-GDR.
  + SQL Server 2019 Enterprise, Standard, or Web, with CU8, CU17, CU18, CU20, CU24, CU26, CU28-GDR, CU29-GDR, CU30, CU32, and CU32-GDR.
+ For CEVs using bring your own media (BYOM):
  + SQL Server 2022 Enterprise, Standard, or Developer, with CU9, CU13, CU14-GDR, CU15-GDR, CU16, CU17, CU18, CU19, CU19-GDR, CU20-GDR, CU21-GDR, CU22, CU22-GDR, CU23 and CU23-GDR.
  + SQL Server 2019 Enterprise, Standard, or Developer, with CU8, CU17, CU18, CU20, CU24, CU26, CU28-GDR, CU29-GDR, CU30, CU32, and CU32-GDR.
+ For CEVs using pre-installed media or bring your own media (BYOM), Windows Server 2019 is the only supported OS.

For more information, see [AWS Windows AMI version history](https://docs.aws.amazon.com/ec2/latest/windows-ami-reference/ec2-windows-ami-version-history.html). 

## Requirements for RDS Custom for SQL Server CEVs
<a name="custom-cev-sqlserver.preparing.Requirements"></a>

The following requirements apply to creating a CEV for RDS Custom for SQL Server:
+ The AMI used to create a CEV must be based on an OS and database configuration supported by RDS Custom for SQL Server. For more information on supported configurations, see [Requirements and limitations for Amazon RDS Custom for SQL Server](custom-reqs-limits-MS.md).
+ The CEV must have a unique name. You can't create a CEV with the same name as an existing CEV.
+ You must name the CEV using a naming pattern of SQL Server *major version \$1 minor version \$1 customized string*. The *major version \$1 minor version* must match the SQL Server version provided with the AMI. For example, you can name an AMI with SQL Server 2019 CU17 as **15.00.4249.2.my\$1cevtest**.
+ You must prepare an AMI using Sysprep. For more information about prepping an AMI using Sysprep, see [Create a standardized Amazon Machine Image (AMI) using Sysprep](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-create-win-sysprep.html).
+ You are responsible for maintaining the life cycle of the AMI. An RDS Custom for SQL Server DB instance created from a CEV doesn't store a copy of the AMI. It maintains a pointer to the AMI that you used to create the CEV. The AMI must exist for an RDS Custom for SQL Server DB instance to remain operable.

## Limitations for RDS Custom for SQL Server CEVs
<a name="custom-cev-sqlserver.preparing.Limitations"></a>

The following limitations apply to custom engine versions with RDS Custom for SQL Server:
+ You can't delete a CEV if there are resources, such as DB instances or DB snapshots, associated with it.
+ To create an RDS Custom for SQL Server DB instance, a CEV must have a status of `pending-validation`, `available`, `failed`, or `validating`. You can't create an RDS Custom for SQL Server DB instance using a CEV if the CEV status is `incompatible-image-configuration`.
+ To modify a RDS Custom for SQL Server DB instance to use a new CEV, the CEV must have a status of `available`.
+ You can't create an AMI or CEV from an existing RDS Custom for SQL Server DB instance.
+ You can't modify an existing CEV to use a different AMI. However, you can modify an RDS Custom for SQL Server DB instance to use a different CEV. For more information, see [Modifying an RDS Custom for SQL Server DB instance](custom-managing.modify-sqlserver.md).
+ Encrypting an AMI or CEV with a customer-managed KMS key different than the KMS key provided during DB instance creation is not supported.
+ Cross-Region copy of CEVs isn't supported.
+ Cross-account copy of CEVs isn't supported.
+ You can't restore or recover a CEV after you delete it. However, you can create a new CEV from the same AMI.
+ A RDS Custom for SQL Server DB instance stores your SQL Server database files in the *D:\$1*drive. The AMI associated with a CEV should store the Microsoft SQL Server system database files in the *C:\$1* drive.
+ An RDS Custom for SQL Server DB instance retains your configuration changes made to SQL Server. Any configuration changes to the OS on a running RDS Custom for SQL Server DB instance created from a CEV aren't retained. If you need to make a permanent configuration change to the OS and have it retained as your new baseline configuration, create a new CEV and modify the DB instance to use the new CEV.
**Important**  
Modifying an RDS Custom for SQL Server DB instance to use a new CEV is an offline operation. You can perform the modification immediately or schedule it to occur during a weekly maintenance window.
+ When you modify a CEV, Amazon RDS doesn't push those modifications to any associated RDS Custom for SQL Server DB instances. You must modify each RDS Custom for SQL Server DB instance to use the new or updated CEV. For more information, see [Modifying an RDS Custom for SQL Server DB instance](custom-managing.modify-sqlserver.md).
+ 
**Important**  
If an AMI used by a CEV is deleted, any modifications that may require host replacement, for example, scale compute, will fail. The RDS Custom for SQL Server DB instance will then be placed outside of the RDS support perimeter. We recommend that you avoid deleting any AMI that's associated to a CEV.

# Creating a CEV for RDS Custom for SQL Server
<a name="custom-cev-sqlserver.create"></a>

You can create a custom engine version (CEV) using the AWS Management Console or the AWS CLI. You can then use the CEV to create an RDS Custom for SQL Server DB instance.

Make sure that the Amazon Machine Image (AMI) is in the same AWS account and Region as your CEV. Otherwise, the process to create a CEV fails.

For more information, see [Creating and connecting to a DB instance for Amazon RDS Custom for SQL Server](custom-creating-sqlserver.md).

**Important**  
The steps to create a CEV are the same for AMIs created with pre-installed SQL Server and those created using bring your own media (BYOM).

## Console
<a name="custom-cev-sqlserver.create.console"></a>

**To create a CEV**

1. Sign in to the AWS Management Console and open the Amazon RDS console at [https://console.aws.amazon.com/rds/](https://console.aws.amazon.com/rds/).

1. In the navigation pane, choose **Custom engine versions**.

   The **Custom engine versions** page shows all CEVs that currently exist. If you haven't created any CEVs, the table is empty.

1. Choose **Create custom engine version**.

1. For **Engine type**, choose **Microsoft SQL Server**.

1. For **Edition**, choose the DB engine edition that you want to use.

1. For **Major version**, choose the major engine version that's installed on your AMI.

1. In **Version details**, enter a valid name in **Custom engine version name**.

   The name format is `major-engine-version.minor-engine-version.customized_string`. You can use 1–50 alphanumeric characters, underscores, dashes, and periods. For example, you might enter the name **15.00.4249.2.my\$1cevtest**.

   Optionally, enter a description for your CEV.

1. For **Installation Media**, browse to or enter the AMI ID that you'd like to create the CEV from.

1. In the **Tags** section, add any tags to identify the CEV.

1. Choose **Create custom engine version**.

The **Custom engine versions** page appears. Your CEV is shown with the status **pending-validation**

## AWS CLI
<a name="custom-cev-sqlserver.create.CEV"></a>

To create a CEV by using the AWS CLI, run the [create-custom-db-engine-version](https://docs.aws.amazon.com/cli/latest/reference/rds/create-custom-db-engine-version.html) command.

The following options are required:
+ `--engine`
+ `--engine-version`
+ `--image-id`

You can also specify the following options:
+ `--description`
+ `--region`
+ `--tags`

The following example creates a CEV named `15.00.4249.2.my_cevtest`. Make sure that the name of your CEV begins with the major engine version number.

**Example**  
For Linux, macOS, or Unix:  

```
1. aws rds create-custom-db-engine-version \
2.     --engine custom-sqlserver-ee \
3.     --engine-version 15.00.4249.2.my_cevtest \
4.     --image-id ami-0r93cx31t5r596482 \                    
5.     --description "Custom SQL Server EE 15.00.4249.2 cev test"
```
The following partial output shows the engine, parameter groups, and other information.  

```
 1. "DBEngineVersions": [
 2.     {
 3.     "Engine": "custom-sqlserver-ee",
 4.     "MajorEngineVersion": "15.00",
 5.     "EngineVersion": "15.00.4249.2.my_cevtest",
 6.     "DBEngineDescription": "Microsoft SQL Server Enterprise Edition for RDS Custom for SQL Server",
 7.     "DBEngineVersionArn": "arn:aws:rds:us-east-1:<my-account-id>:cev:custom-sqlserver-ee/15.00.4249.2.my_cevtest/a1234a1-123c-12rd-bre1-1234567890",
 8.     "DBEngineVersionDescription": "Custom SQL Server EE 15.00.4249.2 cev test",
 9.                                                       
10.     "Image": [
11.         "ImageId": "ami-0r93cx31t5r596482",
12.         "Status": "pending-validation"
13.      ],
14.     "CreateTime": "2022-11-20T19:30:01.831000+00:00",
15.     "SupportsLogExportsToCloudwatchLogs": false,
16.     "SupportsReadReplica": false,
17.     "Status": "pending-validation",
18.     "SupportsParallelQuery": false,
19.     "SupportsGlobalDatabases": false,
20.     "TagList": []
21.     }
22. ]
```

If the process to create a CEV fails, RDS Custom for SQL Server issues `RDS-EVENT-0198` with the message `Creation failed for custom engine version major-engine-version.cev_name`. The message includes details about the failure, for example, the event prints missing files. To find troubleshooting ideas for CEV creation issues, see [Troubleshooting CEV errors for RDS Custom for SQL Server](custom-troubleshooting-sqlserver.md#custom-troubleshooting-sqlserver.cev).

## Create an RDS Custom for SQL Server DB instance from a CEV
<a name="custom-cev-sqlserver.create.newdbinstance"></a>

After you successfully create a CEV, the **CEV status** shows `pending-validation`. You can now create a new RDS Custom for SQL Server DB instance using the CEV. To create a new RDS Custom for SQL Server DB instance from a CEV, see [Creating an RDS Custom for SQL Server DB instance](custom-creating-sqlserver.md#custom-creating-sqlserver.create).

## Lifecycle of a CEV
<a name="custom-cev-sqlserver.create.lifecycle"></a>

The CEV lifecycle includes the following statuses.


****  

| CEV status | Description | Troubleshooting suggestions | 
| --- | --- | --- | 
| `pending-validation` | A CEV was created and is pending the validation of the associated AMI. A CEV will remain in `pending-validation` until an RDS Custom for SQL Server DB instance is created from it. | If there are no existing tasks, create a new RDS Custom for SQL Server DB instance from the CEV. When creating the RDS Custom for SQL Server DB instance, the system attempts to validate the associated AMI for a CEV.  | 
| `validating` | A creation task for the RDS Custom for SQL Server DB instance based on a new CEV is in progress. When creating the RDS Custom for SQL Server DB instance, the system attempts to validate the associated AMI of a CEV. | Wait for the creation task of the existing RDS Custom for SQL Server DB instance to complete. You can use the RDS EVENTS console to review detailed event messages for troubleshooting.  | 
| `available` | The CEV was successfully validated. A CEV will enter the `available` status once an RDS Custom for SQL Server DB instance has been successfully created from it. | The CEV doesn't require any additional validation. It can be used to create additional RDS Custom for SQL Server DB instances or modify existing ones. | 
| `inactive` | The CEV has been modified to an inactive state. | You can't create or upgrade an RDS Custom DB instance with this CEV. Also, you can't restore a DB snapshot to create a new RDS Custom DB instance with this CEV. For information about how to change the state to `ACTIVE`, see [Modifying a CEV for RDS Custom for SQL Server](custom-cev-sqlserver-modifying.md). | 
| `failed` | The create DB instance step failed for this CEV before it could validate the AMI. Alternatively, the underlying AMI used by the CEV isn't in an available state. | Troubleshoot the root cause for why the system couldn't create the DB instance. View the detailed error message and try to create a new DB instance again. Ensure that the underlying AMI used by the CEV is in an available state. | 
| `incompatible-image-configuration` | There was an error validating the AMI. | View the technical details of the error. You can't attempt to validate the AMI with this CEV again. Review the following: recommendations: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-cev-sqlserver.create.html) Create a new CEV using the correct information. If needed, create a new EC2 instance using a supported AMI and run the Sysprep process on it.  | 

# Modifying a CEV for RDS Custom for SQL Server
<a name="custom-cev-sqlserver-modifying"></a>

You can modify a CEV using the AWS Management Console or the AWS CLI. You can modify the CEV description or its availability status. Your CEV has one of the following status values:
+ `available` – You can use this CEV to create a new RDS Custom DB instance or upgrade a DB instance. This is the default status for a newly created CEV.
+ `inactive` – You can't create or upgrade an RDS Custom DB instance with this CEV. You can't restore a DB snapshot to create a new RDS Custom DB instance with this CEV.

You can change the CEV status from `available` to `inactive` or from `inactive` to `available`. You might change the status to `INACTIVE` to prevent the accidental use of a CEV or to make a discontinued CEV eligible for use again.

## Console
<a name="custom-cev-sqlserver-modifying.console"></a>

**To modify a CEV**

1. Sign in to the AWS Management Console and open the Amazon RDS console at [https://console.aws.amazon.com/rds/](https://console.aws.amazon.com/rds/).

1. In the navigation pane, choose **Custom engine versions**.

1. Choose a CEV whose description or status you want to modify.

1. For **Actions**, choose **Modify**.

1. Make any of the following changes:
   + For **CEV status settings**, choose a new availability status.
   + For **Version description**, enter a new description.

1. Choose **Modify CEV**.

   If the CEV is in use, the console displays **You can't modify the CEV status**. Fix the problems, then try again.

The **Custom engine versions** page appears.

## AWS CLI
<a name="custom-cev-sqlserver-modifying.cli"></a>

To modify a CEV by using the AWS CLI, run the [modify-custom-db-engine-version](https://docs.aws.amazon.com/cli/latest/reference/rds/modify-custom-db-engine-version.html) command. You can find CEVs to modify by running the [describe-db-engine-versions](https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-engine-versions.html) command.

The following options are required:
+ `--engine`
+ `--engine-version cev`, where *`cev`* is the name of the custom engine version that you want to modify
+ `--status`` status`, where *`status`* is the availability status that you want to assign to the CEV

The following example changes a CEV named `15.00.4249.2.my_cevtest` from its current status to `inactive`.

**Example**  
For Linux, macOS, or Unix:  

```
1. aws rds modify-custom-db-engine-version \
2.     --engine custom-sqlserver-ee \ 
3.     --engine-version 15.00.4249.2.my_cevtest \
4.     --status inactive
```
For Windows:  

```
1. aws rds modify-custom-db-engine-version ^
2.     --engine custom-sqlserver-ee ^
3.     --engine-version 15.00.4249.2.my_cevtest ^
4.     --status inactive
```

To modify an RDS Custom for SQL Server DB instance to use a new CEV, see [Modifying an RDS Custom for SQL Server DB instance to use a new CEV](custom-cev-sqlserver-modifying-dbinstance.md).

# Modifying an RDS Custom for SQL Server DB instance to use a new CEV
<a name="custom-cev-sqlserver-modifying-dbinstance"></a>

You can modify an existing RDS Custom for SQL Server DB instance to use a different CEV. The changes that you can make include:
+ Changing the CEV
+ Changing the DB instance class
+ Changing the backup retention period and backup window
+ Changing the maintenance window

## Console
<a name="custom-cev-sqlserver-modifying-dbinstance.CON"></a>

**To modify an RDS Custom for SQL Server DB instance**

1. Sign in to the AWS Management Console and open the Amazon RDS console at [https://console.aws.amazon.com/rds/](https://console.aws.amazon.com/rds/).

1. In the navigation pane, choose **Databases**.

1. Choose the DB instance that you want to modify.

1. Choose **Modify**.

1. Make the following changes as needed:

   1. For **DB engine version**, choose a different CEV.

   1. Change the value for **DB instance class**. For supported classes, see [DB instance class support for RDS Custom for SQL Server](custom-reqs-limits.instancesMS.md).

   1. Change the value for **Backup retention period**.

   1. For **Backup window**, set values for the **Start time** and **Duration**.

   1. For **DB instance maintenance window**, set values for the **Start day**, **Start time**, and **Duration**.

1. Choose **Continue**.

1. Choose **Apply immediately** or **Apply during the next scheduled maintenance window**. 

1. Choose **Modify DB instance**.
**Note**  
When modifying a DB instance from one CEV to an another CEV, for example, when upgrading a minor version, the SQL Server system databases, including their data and configurations, are persisted from the current RDS Custom for SQL Server DB instance.

## AWS CLI
<a name="custom-cev-sqlserver-modifying-dbinstance.CLI"></a>

To modify a DB instance to use a different CEV by using the AWS CLI, run the [modify-db-instance](https://docs.aws.amazon.com/cli/latest/reference/rds/modify-custom-db-engine-version.html) command.

The following options are required:
+ `--db-instance-identifier`
+ `--engine-version cev`, where *`cev`* is the name of the custom engine version that you want the DB instance to change to.

The following example modifies a DB instance named `my-cev-db-instance` to use a CEV named `15.00.4249.2.my_cevtest_new` and applies the change immediately.

**Example**  
For Linux, macOS, or Unix:  

```
1. aws rds modify-db-instance \
2.     --db-instance-identifier my-cev-db-instance \ 
3.     --engine-version 15.00.4249.2.my_cevtest_new \
4.     --apply-immediately
```
For Windows:  

```
1. aws rds modify-db-instance ^
2.     --db-instance-identifier my-cev-db-instance ^
3.     --engine-version 15.00.4249.2.my_cevtest_new ^
4.     --apply-immediately
```

# Viewing CEV details for Amazon RDS Custom for SQL Server
<a name="custom-viewing-sqlserver"></a>

You can view details about your CEV by using the AWS Management Console or the AWS CLI.

## Console
<a name="custom-viewing-sqlserver.console"></a>

**To view CEV details**

1. Sign in to the AWS Management Console and open the Amazon RDS console at [https://console.aws.amazon.com/rds/](https://console.aws.amazon.com/rds/).

1. In the navigation pane, choose **Custom engine versions**.

   The **Custom engine versions** page shows all CEVs that currently exist. If you haven't created any CEVs, the page is empty.

1. Choose the name of the CEV that you want to view.

1. Choose **Configuration** to view the details.  
![\[View the configuration details for a CEV.\]](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/images/rds_custom_sqlserver_cev_viewdetails.PNG)

## AWS CLI
<a name="custom-viewing-sqlserver.CEV"></a>

To view details about a CEV by using the AWS CLI, run the [describe-db-engine-versions](https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-engine-versions.html) command.

You can also specify the following options:
+ `--include-all`, to view all CEVs with any lifecycle state. Without the `--include-all` option, only the CEVs in an `available` lifecycle state will be returned.

```
aws rds describe-db-engine-versions --engine custom-sqlserver-ee --engine-version 15.00.4249.2.my_cevtest --include-all
{
    "DBEngineVersions": [
        {
            "Engine": "custom-sqlserver-ee",
            "MajorEngineVersion": "15.00",
            "EngineVersion": "15.00.4249.2.my_cevtest",
            "DBParameterGroupFamily": "custom-sqlserver-ee-15.0",
            "DBEngineDescription": "Microsoft SQL Server Enterprise Edition for custom RDS",
            "DBEngineVersionArn": "arn:aws:rds:us-east-1:{my-account-id}:cev:custom-sqlserver-ee/15.00.4249.2.my_cevtest/a1234a1-123c-12rd-bre1-1234567890",
            "DBEngineVersionDescription": "Custom SQL Server EE 15.00.4249.2 cev test",
            "Image": {
                "ImageId": "ami-0r93cx31t5r596482",
                "Status": "pending-validation"
            },
            "DBEngineMediaType": "AWS Provided",
            "CreateTime": "2022-11-20T19:30:01.831000+00:00",
            "ValidUpgradeTarget": [],
            "SupportsLogExportsToCloudwatchLogs": false,
            "SupportsReadReplica": false,
            "SupportedFeatureNames": [],
            "Status": "pending-validation",
            "SupportsParallelQuery": false,
            "SupportsGlobalDatabases": false,
            "TagList": [],
            "SupportsBabelfish": false
        }
    ]
}
```

You can use filters to view CEVs with a certain lifecycle status. For example, to view CEVs that have a lifecycle status of either `pending-validation`, `available`, or `failed`:

```
aws rds describe-db-engine-versions engine custom-sqlserver-ee
                region us-west-2 include-all query 'DBEngineVersions[?Status == pending-validation || 
                Status == available || Status == failed]'
```

# Deleting a CEV for RDS Custom for SQL Server
<a name="custom-cev-sqlserver-deleting"></a>

You can delete a CEV using the AWS Management Console or the AWS CLI. Typically, this task takes a few minutes.

Before deleting a CEV, make sure it isn't being used by any of the following:
+ An RDS Custom DB instance
+ A snapshot of an RDS Custom DB instance
+ An automated backup of your RDS Custom DB instance

## Console
<a name="custom-cev-sqlserver-deleting.console"></a>

**To delete a CEV**

1. Sign in to the AWS Management Console and open the Amazon RDS console at [https://console.aws.amazon.com/rds/](https://console.aws.amazon.com/rds/).

1. In the navigation pane, choose **Custom engine versions**.

1. Choose a CEV whose description or status you want to delete.

1. For **Actions**, choose **Delete**.

   The **Delete *cev\$1name*?** dialog box appears.

1. Enter **delete me**, and then choose **Delete**.

   In the **Custom engine versions** page, the banner shows that your CEV is being deleted.

## AWS CLI
<a name="custom-cev-sqlserver-deleting.console.cli"></a>

To delete a CEV by using the AWS CLI, run the [delete-custom-db-engine-version](https://docs.aws.amazon.com/cli/latest/reference/rds/delete-custom-db-engine-version.html) command.

The following options are required:
+ `--engine custom-sqlserver-ee`
+ `--engine-version cev`, where *cev* is the name of the custom engine version to be deleted

The following example deletes a CEV named `15.00.4249.2.my_cevtest`.

**Example**  
For Linux, macOS, or Unix:  

```
1. aws rds delete-custom-db-engine-version \
2.     --engine custom-sqlserver-ee \
3.     --engine-version 15.00.4249.2.my_cevtest
```
For Windows:  

```
1. aws rds delete-custom-db-engine-version ^
2.     --engine custom-sqlserver-ee ^
3.     --engine-version 15.00.4249.2.my_cevtest
```