c. Set up Compute Environment
In this step, you will set up an AWS Batch Compute Environment using the AWS Management Console.
Compute environments are Amazon ECS clusters consisting of one or more EC2 instance types, or simply as the number of vCPUs you want to use to run your jobs. For more information on the compute environments, see Compute Environments.
- In the AWS Management Console, use the search bar to search for Batch.
- In the left pane, choose Compute environments, then choose Create.
- Under Compute environment configuration, choose Managed for Compute environment type. This option allows AWS Batch manage the automatic scaling of EC2 resources for you.
- For Compute environment name type stress-ng-ec2.
- Check Enable compute environment. This option enables the AWS Batch environment for use once it has been created.
- For Service role, choose Batch service-linked role. The role allows the AWS Batch service to make calls to the required AWS API operations on your behalf. For more information, see Using Service-Linked Roles.
- Under Instance configuration, choose On-demand for Provisioning model. This option allows EC2 to create resources for you as required.
- Leave the default value of 0 for Minimum vCPUs. This allows your environment to scale down to zero instances when there are no jobs to run.
- For Maximum vCPUs leave the default of 256. This is the upper bound for vCPUs across all concurrently running instances.
- Leave the default value of 0 for Desired vCPUs.
- For Allowed instance types, leave the selection as optimal.
- Select BEST_FIT_PROGRESSIVE for Allocation strategy
- Under Networking, for VPC ID, choose the Default VPC.
- Select all the subnets.
- For Security groups, select the default.
- For Placement groups - optional, leave it empty.
- Under EC2 tags - optional, Add a Tag called Name and for Value, type stress-ng Batch as a name for your instances created with Batch. You can add additional tags if you want.
- Choose Create compute environment to build your new compute environment.
- Once the environment is ready, it will be visible under Compute environments section. Make sure Status is VALID and State is ENABLED.
At this point, you have done the hard part! Continue to the next step to set up a job queue.