

# Runtime versions
<a name="runtime-versions"></a>

When you specify a runtime in the [`runtime-versions`](build-spec-ref.md#build-spec.phases.install.runtime-versions) section of your buildspec file, you can specify a specific version, a specific major version and the latest minor version, or the latest version. The following table lists the available runtimes and how to specify them. Not all runtime versions are available on all images. Runtime version selection is also not supported for the custom images. For more information, see [Available runtimes](available-runtimes.md). If you'd like to install and use a custom runtime version instead of the pre-installed runtime versions, see [Custom runtime versions](#custom-runtime).


**Ubuntu and Amazon Linux 2 platform runtime versions**  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/codebuild/latest/userguide/runtime-versions.html)

You can use a build specification to install other components (for example, the AWS CLI, Apache Maven, Apache Ant, Mocha, RSpec, or similar) during the `install` build phase. For more information, see [Buildspec example](build-spec-ref.md#build-spec-ref-example).

## Custom runtime versions
<a name="custom-runtime"></a>

Instead of using the pre-installed runtime versions in CodeBuild-managed images, you can install and use custom versions of your choice. The following table lists the available custom runtimes and how to specify them.

**Note**  
Custom runtime version selection is only supported for Ubuntu and Amazon Linux images.


**Custom runtime versions**  

| Runtime name  | Syntax | Example | 
| --- | --- | --- | 
| dotnet |  `<major>.<minor>.<patch>`  |  `5.0.408`  | 
| golang |  `<major>.<minor>` `<major>.<minor>.<patch>`  |  `1.19` `1.19.1`  | 
| java |  `corretto<major>`  |  `corretto15`  | 
| nodejs |  `<major>` `<major>.<minor>` `<major>.<minor>.<patch>`  |  `14` `14.21` `14.21.3`  | 
| php |  `<major>.<minor>.<patch>`  |  `8.0.30`  | 
| python |  `<major>` `<major>.<minor>` `<major>.<minor>.<patch>`  |  `3` `3.7` `3.7.16`  | 
| ruby |  `<major>.<minor>.<patch>`  |  `3.0.6`  | 

### Custom runtime buildspec example
<a name="custom-runtime-buildspec"></a>

Here is an example of a buildspec that specifies custom runtime versions.

```
version: 0.2
phases:
  install:
    runtime-versions:
      java: corretto15
      php: 8.0.30
      ruby: 3.0.6
      golang: 1.19
      python: 3.7
      nodejs: 14
      dotnet: 5.0.408
```