Deployment of AWS::Batch::JobDefinition with VCPU less then 1 not possible

0

Hello,

i tried to deploy a AWS::Batch::JobDefinition with AWS SAM and it didn't work. This is the error message i get when running the sam deploy command:

An error occurred (ClientException) when calling the                                                                                                                                                                        RegisterJobDefinition operation: Error executing
request, Exception : Value 0.25 for type VCPU in      
resourceRequirement is not valid. Please provide a
numeric value.

The template.yaml looks like this:

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
  test
Globals:
  Function:
    Timeout: 3

Resources:
  BackendAPI:
    Type: AWS::Serverless::HttpApi
  DataBucket:
    Type: 'AWS::S3::Bucket'
  SubmitAnalysisLambda:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: serverless_analysis/
      Handler: submit.lambda_handler
      Runtime: python3.9
      MemorySize: 512
      Environment:
        Variables:
          S3_BUCKET_NAME: !Ref DataBucket
      Architectures:
        - arm64
      Events:
        Submit:
          Type: HttpApi
          Properties:
            ApiId: !Ref BackendAPI
            Path: /analysis
            Method: post
  OA2BatchComputeEnvironment:
    Type: AWS::Batch::ComputeEnvironment
    Properties:
      Type: MANAGED
      ComputeResources:
        MaxvCpus: 5
        Type: FARGATE_SPOT
        Subnets:
          - subnet-<REDACTED>
          - subnet-<REDACTED>
        SecurityGroupIds:
          - !Ref OA2BatchSecurityGroup
  OA2BatchSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: Security-Group for Compute Environment
      SecurityGroupEgress:
        - CidrIp: 0.0.0.0/0
          IpProtocol: -1
          FromPort: -1
          ToPort: -1
      VpcId: vpc-<REDACTED>
  OA2BatchJobQueue:
    Type: AWS::Batch::JobQueue
    Properties:
      ComputeEnvironmentOrder:
        - ComputeEnvironment: !Ref OA2BatchComputeEnvironment
          Order: 1
      Priority: 1
  OA2BatchJobDefinition:
    Type: AWS::Batch::JobDefinition
    Properties:
      Type: container
      ContainerProperties:
        Command:
          - hello-world
        Environment:
          - Name: OA2_DATA_BUCKET
            Value: !Ref DataBucket
        Image: hello-world
        ResourceRequirements:
          - Type: VCPU
            Value: 0.25
          - Type: MEMORY
            Value: 512

The last 4 lines are the one causing the problem. As soon as i replace the 0.25 with anything higher or equal to 1 it works. I also tried to specify one million vCPUs and it worked as well.

Is this a bug or am i missing something?

Best regards, Flo

asked 2 years ago613 views
1 Answer
0

Ok i figured it out... I forgot to add this Property:

      PlatformCapabilities:
        - FARGATE

after adding this to the Job Definition it worked.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions