compose-to-batch
npm i compose-to-batch

compose-to-batch

A CLI tool to transform a docker-compose.yml into an AWS Batch job definition

by turnerlabs

0.1.2 (see all)License:Apache-2TypeScript:Not Found
npm i compose-to-batch
Readme

compose-to-batch

A CLI tool to transform a docker-compose.yml into an AWS Batch job definition.

This tool allows you to develop your job code on your laptop using docker:

$ docker-compose up

And then when you're ready to deploy to AWS Batch:

$ docker-compose config | compose-to-batch > job-definition.json
$ aws batch register-job-definition --cli-input-json file://job-definition.json

usage

install

npm install -g compose-to-batch

given the following docker-compose.yml

version: "2"
services:
  my-job:
    build: .
    image: 12345678910.dkr.ecr.us-east-1.amazonaws.com/my-job:0.1.0
    environment:
      REGION: us-east-1
    labels:      
      composeToBatch.vcpus: 2
      composeToBatch.memory: 2000
      composeToBatch.jobRoleArn: arn:aws:iam::12345678910:role/my-role

running the following command

cat docker-compose.yml | compose-to-batch

will output the following

{
  "jobDefinitionName": "my-job",
  "type": "container",
  "containerProperties": {
    "image": "image: 12345678910.dkr.ecr.us-east-1.amazonaws.com/my-job:0.1.0",
    "environment": [
      {
        "name": "REGION",
        "value": "us-east-1"
      }
    ],
    "vcpus": "2",
    "memory": "2000",
    "jobRoleArn": "arn:aws:iam::12345678910:role/my-role"
  }
}

mapping

  • service -> jobDefinitionName
  • service.image -> containerProperties.image
  • service.command -> containerProperties.command
  • service.environment -> containerProperties.environment
  • service.labels.composeToBatch.vcpus -> containerProperties.vcpus
  • service.labels.composeToBatch.memory -> containerProperties.memory
  • service.labels.composeToBatch.jobRoleArn -> containerProperties.jobRoleArn

Downloads/wk

11

GitHub Stars

18

LAST COMMIT

5yrs ago

MAINTAINERS

1

CONTRIBUTORS

2

OPEN ISSUES

1

OPEN PRs

0
VersionTagPublished
0.1.2
latest
5yrs ago
No alternatives found
No tutorials found
Add a tutorial