Giter Club home page Giter Club logo

aws-batch-helpers's Introduction

aws-batch-helpers's People

Contributors

dougalb avatar kiuka9 avatar kiukchung avatar rgeorgej avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-batch-helpers's Issues

Add LaunchTemplate Example

I hope I am in the right place for this comment:

I spent quite a bit of time working to get a aws batch launch template through a cloud formation template. I needed extra data volume on an EC2 instance I was hoping you could add this to as a second example instead of creating a new EC2 instance which is not required when you have LaunchTemplate that can be used in AWS Batch, thankfully!

What was really difficult to figure out was the version on ComputeEnvironment ref to the latest LaunchTemplate:

SpecialComputeEnvironment:
    Type: "AWS::Batch::ComputeEnvironment"
    Properties:
      Type: MANAGED
      ComputeEnvironmentName: !Sub "Special-ComputeEnvironment-${AWS::Region}-1" 
      ServiceRole: !Ref SpecialServiceRole
      ComputeResources:
        MaxvCpus: 256
        SecurityGroupIds:
          - !Ref SecurityGroup
        Subnets: !Ref Subnets
        Type: EC2
        MinvCpus: 0
        ImageId: ami-007571470797b8ffa # ami-0a6a36557ea3b9859
        InstanceRole: !Ref SpecialInstanceProfile
        InstanceTypes:
          - optimal
        LaunchTemplate:
          **LaunchTemplateId: !Ref SpecialComputeLaunchTemplate**
          **Version: !GetAtt SpecialComputeLaunchTemplate.LatestVersionNumber**
        DesiredvCpus: 0
      State: ENABLED

And the LaunchTemplates UserData:

  SpecialComputeLaunchTemplate:
    Type: AWS::EC2::LaunchTemplate
    Properties:
      LaunchTemplateName: "Special-inc-volume-encrypt"
      LaunchTemplateData:
        BlockDeviceMappings:
          - DeviceName:  '/dev/sdb'  # Amazon ECS-Optimized Amazon Linux 2 ami accepts EDS vol /dev/sd[b-l]
            Ebs:
              DeleteOnTermination: true
              Encrypted: true
              VolumeSize: 250
              VolumeType: "gp2"
        UserData:
         "Fn::Base64": !Sub |
            MIME-Version: 1.0
            Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="

            --==MYBOUNDARY==
            Content-Type: text/x-shellscript; charset="us-ascii"

            #!/bin/bash          
            mkfs.ext4  /dev/sdb
            (
            echo n # Add a new partition
            echo p # Primary partition
            echo 1 # Partition number
            echo   # First sector (Accept default: 1)
            echo   # Last sector (Accept default: varies)
            echo w # Write changes
            ) | fdisk  /dev/sdb
            mkfs.ext4  /dev/xvdb1
            mkdir /data
            echo " /dev/xvdb1       /data  ext4    defaults        0       2" >> /etc/fstab
            mount -a
            serSpeciale docker restart 

            --==MYBOUNDARY==

https://github.com/vfrank66/awsbatchlaunchtemplate

Private docker images

Launch Template :

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="

--==MYBOUNDARY==

Content-Type: text/x-shellscript; charset="us-ascii"


#!/bin/bash
echo ECS_IMAGE_CLEANUP_INTERVAL=60m >> /etc/ecs/ecs.config
echo ECS_IMAGE_MINIMUM_CLEANUP_AGE=60m >> /etc/ecs/ecs.config
export DOCKER_USERNAME=boomtable
export DOCKER_PASSWORD=xyz
docker login  --username $DOCKER_USERNAME --password=$DOCKER_PASSWORD
--==MYBOUNDARY==--

Error while triggering the batch job !

Status reason

Task failed to start

Container message

CannotPullContainerError: Error response from daemon: pull access denied for myprivate/testbatch, repository does not exist or may require 'docker login'

Am i doing anything stupid !? is this a right way to do it ?

Where is the output?

Hey!

I am trying to use fetch & run script together with my custom script. I am trying to download a file using aws s3 cp S3_SOURCE . However, the file seems to get downloaded, but when doing an ls -al ., nothing is there... It seems fetch & run script is hiding stderr or something cause I have no idea what is going on..
2021-05-24_22h17_07

The docker I am using is created like this:
2021-05-24_22h17_35

Help appreciated, where is the file?

ParamValidationError for imageId create batch entities

When I run the create-batch-entities.py script to create batch entities, I get the following validation error. I have tried passing in the imageId with and without the 'ami-' prefix with the same outcome. I am using Python 2.7.12 and boto-2.48.0.

Traceback (most recent call last):
  File "create-batch-entities.py", line 167, in <module>
    main()
  File "create-batch-entities.py", line 158, in main
    keyPair=keyPair)
  File "create-batch-entities.py", line 56, in create_compute_environment
    'instanceRole': instanceRole
  File "/Library/Python/2.7/site-packages/botocore/client.py", line 251, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Library/Python/2.7/site-packages/botocore/client.py", line 513, in _make_api_call
    api_params, operation_model, context=request_context)
  File "/Library/Python/2.7/site-packages/botocore/client.py", line 566, in _convert_to_request_dict
    api_params, operation_model)
  File "/Library/Python/2.7/site-packages/botocore/validate.py", line 270, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in computeResources: "imageId", must be one of: type, minvCpus, maxvCpus, desiredvCpus, instanceTypes, subnets, securityGroupIds, ec2KeyPair, instanceRole, tags, bidPercentage, spotIamFleetRole```

Error "Unable to find AWS CLI executable."

Summary

There are multiple resources available out there that reference the files in this project. I have painstakingly went through many of them attempting to find where the gap is on this issue and am hoping to save others that same pain.

The AWS CLI is indeed available in the image, so the error is actually misleading. After tracing the fetch-and-run/fetch_and_run.sh script the lines below throw false positives due to the which command no longer being part of the amazonlinux image.

# Check that necessary programs are available
which aws >/dev/null 2>&1 || error_exit "Unable to find AWS CLI executable."
which unzip >/dev/null 2>&1 || error_exit "Unable to find unzip executable."

You could simply remove those lines and operate under the assumption that these are installed (since you are explicitly installing them anyway) or you could keep the check by modifying them to something like the following:

# Check that necessary programs are available
aws --version >/dev/null 2>&1 || error_exit "Unable to find AWS CLI executable."
unzip -v >/dev/null 2>&1 || error_exit "Unable to find unzip executable."

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.