g. Set up a Job Definition
In this step, you will set up a template for your jobs, known as a Job Definition. For more information see Job Definitions.
- In the AWS Batch Dashboard, choose Job definitions from the left pane, then Create.
- Select the Single-node option
- Type stress-ng-job-definition as the Name.
- For Execution timeout, type 180. This option specifies the total time the job is expected to run plus some buffer. If the job continues to run after this time you would consider it to have failed.
- Select EC2 as the platform.
- Choose None for Execution role.
- Under Job configuration, for Image, enter the repositoryUri generated when you created the stress-ng ECR repository. If you do not know the URI, you can use the following command in your terminal to get it.
aws ecr describe-repositories --repository-names stress-ng --output text --query 'repositories.[repositoryUri]'
- Clear out the contents of the Command text box. You don’t want to run any command when your job runs as your container is already set up to excute the docker-entrypoint.sh script when it starts.
- For vCPUs type 1.
- For Memory (MiB) type 1024.
- Leave the value as blank for Number of GPUs field.
- Under Retry Strategies, for Job attempts, type 3. This option specifies the number of attempts before declaring a job as failed.
- Scroll to the bottom of the page and Choose Create.
- Once the Job definition is ready, it will be visible under Job definitions grid. Make sure Status is ACTIVE.
Next you will take a closer look at the compute environment, job queue, and job definition that you have created.