From 93657b76d3ce3e26bbdbde485e26273b9c109e83 Mon Sep 17 00:00:00 2001 From: Robert Djurasaj Date: Wed, 5 Aug 2020 13:43:25 -0600 Subject: [PATCH] docs(batch): Clearer explanation on changes to the baseline AMI of the compute resources (#9460) Made it more clear in docs on how to update AWS Batch's underlying AMIs. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-batch/README.md | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/@aws-cdk/aws-batch/README.md b/packages/@aws-cdk/aws-batch/README.md index 83589b65a12f8..314d647dec76e 100644 --- a/packages/@aws-cdk/aws-batch/README.md +++ b/packages/@aws-cdk/aws-batch/README.md @@ -138,6 +138,36 @@ Below is an example: const computeEnv = batch.ComputeEnvironment.fromComputeEnvironmentArn(this, 'imported-compute-env', 'arn:aws:batch:us-east-1:555555555555:compute-environment/My-Compute-Env'); ``` +### Change the baseline AMI of the compute resources + +Ocassionally, you will need to deviate from the default processing AMI. + +ECS Optimized Amazon Linux 2 example: + +```ts +const myComputeEnv = new batch.ComputeEnvironment(this, 'ComputeEnv', { + computeResources: { + image: new ecs.EcsOptimizedAmi({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + }), + vpc, + } +}); +``` + +Custom based AMI example: + +```ts +const myComputeEnv = new batch.ComputeEnvironment(this, 'ComputeEnv', { + computeResources: { + image: ec2.MachineImage.genericLinux({ + "[aws-region]": "[ami-ID]", + }) + vpc, + } +}); +``` + ## Job Queue Jobs are always submitted to a specific queue. This means that you have to create a queue before you can start submitting jobs. Each queue is mapped to at least one (and no more than three) compute environment. When the job is scheduled for execution, AWS Batch will select the compute environment based on ordinal priority and available capacity in each environment.