@@ -2223,20 +2223,34 @@ export class WindowsBuildImage implements IBuildImage {
22232223 const errors : string [ ] = [ ] ;
22242224
22252225 if ( buildEnvironment . privileged ) {
2226+ // Reference: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html
2227+ // "Also, Windows does not support privileged mode."
2228+ // Last accessed: 2025-04-12
22262229 errors . push ( 'Windows images do not support privileged mode' ) ;
22272230 }
22282231
22292232 if ( buildEnvironment . computeType && isLambdaComputeType ( buildEnvironment . computeType ) ) {
2233+ // Reference: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html
2234+ // The table below the sentence "AWS CodeBuild provides build environments with the following available memory and disk space for AWS Lambda compute mode:" does not include Windows environment types.
2235+ // Last accessed: 2025-04-12
22302236 errors . push ( 'Windows images do not support Lambda compute types' ) ;
22312237 }
22322238
2233- const unsupportedComputeTypes = [ ComputeType . SMALL , ComputeType . X_LARGE , ComputeType . X2_LARGE ] ;
2239+ const unsupportedComputeTypes = [ ComputeType . SMALL ] ;
22342240 if ( buildEnvironment . computeType !== undefined && unsupportedComputeTypes . includes ( buildEnvironment . computeType ) ) {
2241+ // Reference: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html#environment.types
2242+ // The table includes Windows Medium, Large, XLarge, and 2XLarge.
2243+ // Last accessed: 2025-04-12
22352244 errors . push ( `Windows images do not support the '${ buildEnvironment . computeType } ' compute type` ) ;
22362245 }
22372246
2238- if ( ! buildEnvironment . fleet && this . type === WindowsImageType . SERVER_2022 ) {
2239- errors . push ( 'Windows Server 2022 images must be used with a fleet' ) ;
2247+ const supportedOnDemandEnvironmentRegion = [ 'us-east-2' , 'us-east-1' , 'us-west-2' , 'ap-southeast-2' , 'ap-northeast-1' , 'eu-central-1' , 'eu-west-1' , 'sa-east-1' ] ;
2248+ if ( ! buildEnvironment . fleet && this . type === WindowsImageType . SERVER_2022 && ! supportedOnDemandEnvironmentRegion . includes ( Aws . REGION ) ) {
2249+ // Reference: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html#environment.types
2250+ // The environment type WINDOWS_SERVER_2022_CONTAINER is only available in these Regions: [...]
2251+ // The environment type WINDOWS_EC2 (BUILD_GENERAL1_MEDIUM, BUILD_GENERAL1_LARGE) is only available in these Regions: [...]
2252+ // Last accessed: 2025-04-12
2253+ errors . push ( `Windows Server 2022 images must be used with a fleet in ${ Aws . REGION } ` ) ;
22402254 }
22412255
22422256 return errors ;
0 commit comments