-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.env
324 lines (307 loc) · 20.1 KB
/
.env
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
#!/bin/bash
######################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# SPDX-License-Identifier: MIT-0 #
######################################################################
# Source helper functions
source .fun
source .fun2
source .fun3
# Set index
export IDX=$(if [ -f .idx ]; then cat .idx; else echo "1"; fi | tr -d '\r')
# Proxy settings [optional] - set if your network requires a proxy to connect to the Internet
export http_proxy=
export https_proxy=
export no_proxy=localhost
# Project settings
## PROJECT_HOME - project home directory, PROJECT_HOME=$(pwd)
if [ "${PROJECT_HOME}" == "" ]; then
export PROJECT_HOME=$(pwd)
fi
## CMD_EDIT - text editor command used when editing config file. Default CMD_EDIT='vim -c ":syntax on"'
export CMD_EDIT='vim -c ":syntax on"'
## Target orchestrator TO=docker|compose|ecs|swarm|kubernetes|eks|lambda|batchlocal|batch
## docker - choose when running locally or on ec2
## compose - choose when running locally, on ec2
## ecs - choose when running on ecs with or without Fargate
## swarm - choose when running on a docker swarm
## kubernetes - choose when running on a local, remote Kubernetes cluster or EKS, with or without Fargate
## lambdalocal - choose when developing and testing an AWS Lambda container locally
## lambda - choose when running containerized function on AWS Lambda
## batchlocal - choose when running containerized jobs locally
## batch - choose when running containerized jobs on AWS Batch
export TO=$(if [ -f wd/.to ]; then cat wd/.to; else echo "docker"; fi | tr -d '\r')
## BUILD_TO - target orchestrator for building docker images BUILD_TO=docker|compose
export BUILD_TO=docker
## PROCESSOR - target processor. PROCESSOR=cpu(default)|gpu
export PROCESSOR=cpu
## DOCKERFILE_EXT - dockerfile extension to use when performing operations on a single container DOCKERFILE_EXT="-platform"|"-model_build_ann"|etc. This value is set automatically by build.sh and run.sh.
export DOCKERFILE_EXT=$(if [ -f wd/.dockerfile_ext ]; then cat wd/.dockerfile_ext; else echo "-platform"; fi | tr -d '\r')
export DOCKERFILE=Dockerfile${DOCKERFILE_EXT}
## VERBOSE - show verbose output, VERBOSE=true|false
export VERBOSE=false
## DEBUG - turn on script debugging, DEBUG=false|true
export DEBUG=false
## DRY_RUN - do not execute commands, DRY_RUN=false|true
export DRY_RUN=false
# AWS settings
## AWS_CLI - the AWS cli to use, AWS_CLI=aws(default)|awslocal
export AWS_CLI=aws
## AWS_ENDPOINT - the AWS endpoint to use, AWS_ENPOINT=""(default) | http://aws:4566
#export AWS_ENDPOINT="http://aws:4566"
export AWS_ENDPOINT=""
## AWS_ACCESS_KEY_ID - required credential for access to AWS, can be any value for access to local integration environment
export AWS_ACCESS_KEY_ID=$(if [ -f wd/.aws_id ]; then cat wd/.aws_id; else echo ""; fi | tr -d '\r')
## AWS_SECRET_ACCESS_KEY - required credential for access to AWS, can be any value for access to local integration environment
export AWS_SECRET_ACCESS_KEY=$(if [ -f wd/.aws_cr ]; then cat wd/.aws_cr; else echo ""; fi | tr -d '\r')
### REGION - the region where application will be deployed. Example: REGION=us-west-2
export REGION=us-west-2
export AWS_DEFAULT_REGION=$REGION
## AWS_OPTS - global options that are added to each aws command
export AWS_OPTS="--no-cli-pager"
if [ ! "$AWS_ENDPOINT" == "" ]; then
export AWS_OPTS="$AWS_OPTS --endpoint-url ${AWS_ENDPOINT}"
fi
# PM settings
## PM_TO - predictive modeling target orchestrator, default PM_TO=compose
export PM_TO=compose
## PM_ID_LENGTH - length of unique identifier in number of characters. Default 16
export PM_ID_LENGTH=32
## PM_PLATFORM_SCALE - number of platform pods to start
export PM_PLATFORM_SCALE=$(if [ -f wd/.platform ]; then cat wd/.platform; else echo "1"; fi | tr -d '\r')
## PM_ROOT_PATH - root path inside the PM containers where artifacts will be stored locally, default: wd
export PM_ROOT_PATH=wd
## PM_S3_BUCKET - bucket name for storing PM objects
export PM_S3_BUCKET=$(if [ -f wd/.s3b ]; then cat wd/.s3b; else echo "aws-do-pm"; fi | tr -d '\r')
## PM_UI_PORT_INT - internal PM UI port, default: PM_UI_PORT_INT=8501
export PM_UI_PORT_INT=8501
## PM_UI_PORT_EXT - external PM UI port, default: PM_UI_PORT_EXT=8501
export PM_UI_PORT_EXT=8501
## PM_UI_HOST_INT - internal PM UI host, default: PM_UI_HOST_INT=platform
export PM_UI_HOST_INT=platform
## PM_UI_HOST_EXT - external PM UI host, default: PM_UI_HOST_EXT=localhost
export PM_UI_HOST_EXT=localhost
## PM_GRAPHDB_PORT_INT - internal PM Graph DB port, default: PM_GRAPHDB_PORT_INT=8529
export PM_GRAPHDB_PORT_INT=8529
## PM_GRAPHDB_PORT_EXT - external PM Graph DB port, default: PM_GRAPHDB_PORT_EXT=8529
export PM_GRAPHDB_PORT_EXT=8529
## PM_GRAPHDB_HOST_INT - internal hostname for the PM Graph DB, default: PM_GRAPHDB_HOST_INT=graphdb
export PM_GRAPHDB_HOST_INT=graphdb
## PM_GRAPHDB_HOST_EXT - external hostname for the PM Graph DB, default: PM_GRAPHDB_HOST_EXT=localhost
export PM_GRAPHDB_HOST_EXT=localhost
## PM_GRAPHDB_URL_INT - internal address of the graph database, default: http://${PM_GRAPHDB_HOST_INT}:${PM_GRAPHDB_PORT_INT}
export PM_GRAPHDB_URL_INT=http://${PM_GRAPHDB_HOST_INT}:${PM_GRAPHDB_PORT_INT}
## PM_GRAPHDB_URL_EXT - external address of the graph database, default: http://${PM_GRAPHDB_HOST_EXT}:${PM_GRAPHDB_PORT_EXT}
export PM_GRAPHDB_URL_EXT=http://${PM_GRAPHDB_HOST_EXT}:${PM_GRAPHDB_PORT_EXT}
## PM_GRAPHDB_SYSTEM_CR - graph database system level credential
export PM_GRAPHDB_SYSTEM_CR=$(if [ -f wd/.graphdb_system_cr ]; then cat wd/.graphdb_system_cr; else echo "root"; fi | tr -d '\r')
## PM_GRAPHDB_NAME - name of the graph database, default: pm
export PM_GRAPHDB_NAME=pm
## PM_GRAPHDB_GRAPH - name of the graph to use for the current use case, default: pm
export PM_GRAPHDB_GRAPH=pm
## PM_GRAPHDB_ID - user id to use when connecting to the graph db
export PM_GRAPHDB_ID=$(if [ -f wd/.graphdb_id ]; then cat wd/.graphdb_id; else echo "pm"; fi | tr -d '\r')
## PM_GRAPHDB_CR - credential to use when connecting to the graph db
export PM_GRAPHDB_CR=$(if [ -f wd/.graphdb_cr ]; then cat wd/.graphdb_cr; else echo "pm"; fi | tr -d '\r')
# Docker image settings
## BASE_IMAGE - your image will be built FROM this BASE_IMAGE as a starting point
export BASE_IMAGE_PATH=python:3.9
## MAINTAINER - the user who owns and maintains this image
export MAINTAINER="$(whoami)"
## DESCRIPTION - short description of what your image does
export DESCRIPTION="Predictive modeling sample for electrical vehicle batteries"
## BUILD - a user-friendly build identifier to distinguish between two images that have the same tag
export BUILD=$(date +%Y%m%d%H%M)
## REGISTRY: [optional] - Docker registry path including trailing "/". Example: registry.company.com/demo/
export REGISTRY=$(if [ -f wd/.registry ]; then cat wd/.registry; else echo ""; fi | tr -d '\r')
if [ -n "${REGISTRY}" ]; then
if [ "${REGISTRY: -1}" != "/" ]; then
export REGISTRY="${REGISTRY}/"
fi
fi
## REGISTRY_TYPE - type of container registry, used by login.sh. REGISTRY_TYPE=ecr
export REGISTRY_TYPE=ecr
## IMAGE_NAME - name of the Docker image for this project. Example: parrot
export IMAGE_NAME=aws-do-pm
## IMAGE - derived Docker image name, do not edit.
export IMAGE=${IMAGE_NAME}${DOCKERFILE_EXT}
## VERSION: [optional] - Version tag for this Docker image. Example: v20180302
#export VERSION=v$(date +%Y%m%d)
export VERSION=latest
export TAG=$(if [ -z "${VERSION}" ]; then echo ""; else echo ":${VERSION}"; fi)
## BUILD_OPTS: [optional] - arguments for the docker image build command
export BUILD_OPTS="--progress plain --file ${DOCKERFILE} --build-arg BUILD=${BUILD} --build-arg BASE_IMAGE_PATH=${BASE_IMAGE_PATH} --build-arg MAINTAINER=\"${MAINTAINER}\" --build-arg DESCRIPTION=\"${DESCRIPTION}\" --build-arg http_proxy=${http_proxy} --build-arg https_proxy=${https_proxy} --build-arg no_proxy=${no_proxy}"
# Target Orchestrator (TO) Settings
## common
### CONTAINER_NAME: [optional] - Name of the Docker container including the --name switch. Example --name myapp
export CONTAINER=${IMAGE}-${TO}
export CONTAINER_NAME="--name ${CONTAINER}"
### PORT_INTERNAL - port on which the application runs inside the container, if more than one port is needed, define additioal variables here
export PORT_INTERNAL=13000
### PORT_EXTERNAL - port to expose outside the container, if more than one port is needed, define additional variables here
### firstAvailable is a function defined in .fun. For local orchestrators, it returns the first available port, starting from the one requested in the argument
export PORT_EXTERNAL=$(firstAvailable 13000)
### VOLUME_PATH_INTERNAL - mount path of volume inside the container
export VOLUME_PATH_INTERNAL=/wd
## VOLUME_PATH_EXTERNAL - external path to mount
export VOLUME_PATH_EXTERNAL=${PROJECT_HOME}/wd
### ENVSUBST - envsubst cli. ENVSUBST=envsubst | "env > /tmp/myanv && docker run --rm -it --env-file /tmp/myenv -v $(pwd):$(pwd) iankoulski/envsubst sh -c envsubst"
export ENVSUBST=envsubst
## docker
### TARGET - target for the current command, TARGET=client|server(default)|ukf
TARGET=server
### Port map [optional] - Mapping of external to internal ports including the -p switch. Example -p 80:8080
#export PORT_MAP="-p ${PORT_EXTERNAL}:${PORT_INTERNAL}"
export PORT_MAP=""
### Volume map [optional] - Mapping of external to internal paths including the -v switch. Example $(pwd):/wd
export VOL_MAP="-v ${VOLUME_PATH_EXTERNAL}:${VOLUME_PATH_INTERNAL}"
### Network [optional] - Network name including the --net switch. Example --net mynet
export NETWORK=
### RUN_OPTS [optional] - additional options to specify with the run comman. Example -e POSTGRES_DB=dbname
export RUN_OPTS="-e PORT_INTERNAL=$PORT_INTERNAL -e ITERATION_LIMIT=3 -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy"
## compose
### DOCKER_COMPOSE - docker-compose cli, DOCKER_COMPOSE=docker-compose | "docker compose",
### please use docker-compose with traditional docker-compose and "docker compose" with Docker Desktop
export DOCKER_COMPOSE="docker-compose"
### DOCKER_COMPOSE_VERSION - Docker Desktop supports Docker Compose v1 and v2. Project container names in v1 are separated with '_' while in v2 the separator is '-'.
### DOCKER_COMPOSE_VERSION = v1(default)|v2
export DOCKER_COMPOSE_VERSION=v1
if [ "$DOCKER_COMPOSE_VERSION" = "v2" ]; then
export DOCKER_COMPOSE_SEP=-
else
export DOCKER_COMPOSE_SEP=_
fi
### COMPOSE_CONTEXT_TYPE - docker compose context type, COMPOSE_CONTEXT_TYPE=moby|ecs,
### please use moby when running against a docker daemon, or ecs when depoying to an AWS ECS context.
COMPOSE_CONTEXT_TYPE=moby
### COMPOSE_PROJECT_NAME - prefix for project containers, example COMPOSE_PROJECT_NAME=compose
export COMPOSE_PROJECT_NAME=aws-do-pm
### COMPOSE_TEMPLATE_PATH - folder containing compose file templates
export COMPOSE_TEMPLATE_PATH=./to/compose/template
### COMPOSE_APP_PATH - folder containig generated compose files
export COMPOSE_APP_PATH=./to/compose/app
### COMPOSE_TEST_PATH - folder containing deployment test scripts
export COMPOSE_TEST_PATH=./to/compose/test
### COMPOSE_FILE - file path of the docker-compose file for the current app
export COMPOSE_FILE=${COMPOSE_APP_PATH}/docker-compose.yaml
### COMPOSE_GPU - GPU resource configuration for compose deployment, depending on value of PROCESSOR setting COMPOSE_GPU=""(default) | "to/compose/app/compose-gpu.txt"
export COMPOSE_GPU=""
if [ "$PROCESSOR" == "gpu" ]; then
export COMPOSE_GPU=$(cat to/compose/app/compose-gpu.txt)
fi
### COMPOSE_AWS - AWS endpoint configuration for compose deployment, depending on value of AWS_ENDPOINT setting COMPOSE_AWS=""(default) | "to/compose/app/compose-aws.txt"
export COMPOSE_AWS=""
if [ ! "$AWS_ENDPOINT" == "" ]; then
export COMPOSE_AWS=$(cat to/compose/template/compose-aws.txt)
fi
## ecs
### ECS_CLI - ecs-cli command, ECS_CLI=ecs-cli
export ECS_CLI=ecs-cli
### ECS_CLUSTER_NAME - name of the ECS cluster to use, if the cluster does not exist, it will be created, ECS_CLUSTER_NAME=default
export ECS_CLUSTER=default
### ECS_MANAGE_CLUSTER - when true create and remove ECS cluster upon run or stop of container, when false assume cluster exists, ECS_MANAGE_CLUSTER=false|true
ECS_MANAGE_CLUSTER=true
### ECS_LAUNCH_TYPE - default launch type for ecs tasks, determines if tasks run on EC2 or Fargate, ECS_LAUNCH_TYPE=EC2|FARGATE
export ECS_LAUNCH_TYPE=EC2
### ECS_COMPOSE_FILE - file path to the docker-compose file for the current ECS app, generated from template
export ECS_COMPOSE_FILE=${COMPOSE_APP_PATH}/ecs-compose.yaml
### ECS_PARAMS_FILE - file with ECS-specific task definition parameters
export ECS_PARAMS_FILE=${COMPOSE_APP_PATH}/ecs-params-${ECS_LAUNCH_TYPE}.yaml
### ECS_TRUST_FILE - file with IAM principal information for ecsTaskExecitonRole and ecsTaskRole
export ECS_TRUST_FILE=${COMPOSE_APP_PATH}/ecs-trust.json
### ECS_EXEC_POLICY_FILE - file with definition of IAM policy ecsExecPolicy for ecsTaskRole
export ECS_EXEC_POLICY_FILE=${COMPOSE_APP_PATH}/ecs-exec-policy.json
### ECS_SG_CIDR - security group CIDR from which to allow connections to the containers, ECS_SG_CIDR=0.0.0.0/0
export ECS_SG_CIDR="0.0.0.0/0"
### ECS_MEM_LIMIT - memory limit for container, ECS_MEM_LIMIT="0.5GB"
export ECS_MEM_LIMIT="0.5GB"
### ECS_CPU_LIMIT - cpu limit for container, 1 vCPU = 1024, ECS_CPU_LIMIT=256
export ECS_CPU_LIMIT=256
### ECS_ASSIGN_PUBLIC_IP - auto-assign public ip to container, ECS_ASSIGN_PUBLIC_IP=ENABLED|DISABLED
export ECS_ASSIGN_PUBLIC_IP=ENABLED
## swarm
### SWARM_STACK_NAME - name of the application stack to deploy, similar to COMPOSE_PROJECT_NAME
export SWARM_STACK_NAME=mystack
### SWARM_SERVICE_NAME - a stack may contain many services. The action scripts are executed agains the service name configured here.
export SWARM_SERVICE_NAME=${CONTAINER}
## kubernetes
### KUBECTL - kubectl cli, KUBECTL=kubectl
export KUBECTL=kubectl
### KUBETAIL - kubetail cli, KUBETAIL=kubetail
export KUBETAIL=kubetail
### KUBERNETES_TEMPLATE_PATH - folder containing Kubernetes manifest templates
export KUBERNETES_TEMPLATE_PATH=./to/kubernetes/template
### KUBERNETES_APP_PATH - folder containing Kubernetes manifests
export KUBERNETES_APP_PATH=./to/kubernetes/app
### APP_NAME - name of the appliation to deploy
export APP_NAME=${IMAGE_NAME}
### APP_DNS_NAME - fully qualified domain name for the application
export APP_DNS_NAME=${IMAGE_NAME}-platform.domain.ext
### NAMESPACE - Kubernetes namespace where the app will run
export NAMESPACE=${IMAGE_NAME}
### INSTANCE_TYPE - optional instance type on which application pods should run. To use, uncomment deployment template nodeSelector section.
export INSTANCE_TYPE=c5.2xlarge
### PV_TYPE - type of persitent volume to use for this application when deployed on Kubernetes, PV_TYPE=efs|hostpath. Default: PV_TYPE=efs. Use hostpath for local, single-node deployments.
export PV_TYPE=$(if [ -f wd/.pv_type ]; then cat wd/.pv_type; else echo "efs"; fi | tr -d '\r')
### EFS_SERVER_NAME - Shared EFS volume server dns name. Set manually after creating an EFS volume. Default: EFS_SERVER_NAME=""
export EFS_VOLUME_ID=$(if [ -f wd/.efs ]; then cat wd/.efs; else echo ""; fi | tr -d '\r')
### EFS_WD_PATH - path to the working directory on the EFS volume. Default EFS_WD_PATH=/wd
export EFS_WD_PATH=/wd
### EFS_WD_PVC_NAME - name of the PVC for mounting the EFS shared working directory volume, Default: EFS_WD_PVC_NAME=pm-efs-wd-pvc
export EFS_WD_PVC_NAME=pm-efs-wd-pvc
### EFS_GRAPHDB_WD_PATH - path to the working directory on the EFS volume for the graph database. Default EFS_GRAPHDB_WD_PATH=/wd/graphdb
export EFS_GRAPHDB_WD_PATH=/wd/graphdb
### ALB_ALLOW_CIDRS - comma-separated list of allowed inbound CIDR blocks for application load balancers. Default ALB_ALLOW_CIDRS=0.0.0.0/0
export ALB_ALLOW_CIDRS=$(if [ -f wd/.allow ]; then cat wd/.allow; else echo "0.0.0.0/0"; fi | tr -d '\r')
### KCFG_ENC - encoded kube config for connecting the platform container to the Kubernetes API
export KCFG_ENC=$(if [ -f wd/.kcfg ]; then cat wd/.kcfg; else echo ""; fi | tr -d '\r')
## lambda
### see https://docs.aws.amazon.com/lambda/latest/dg/runtimes-images.html
### LAMBDA_FUNCTION_NAME - name of the function to create, LAMBDA_FUNCTION_NAME=${CONTAINER}
export LAMBDA_FUNCTION_NAME=${CONTAINER}
### LAMBDA_TEMPLATE_PATH - path to lambda-related templates LAMBDA_TEMPLATE_PATH=./to/lambda/template
export LAMBDA_TEMPLATE_PATH=./to/lambda/template
### LAMBDA_APP_PATH - path to lambda related files generated from templates LAMBDA_APP_PATH=./to/lambda/app
export LAMBDA_APP_PATH=./to/lambda/app
### LAMBDA_TEST_PATH - path to directory containing test scripts for deployed lambda function
export LAMBDA_TEST_PATH=./to/lambda/test
### LAMBDA_TRUST_FILE - file with IAM principal information for lambdaFunctionRole
export LAMBDA_TRUST_FILE=${LAMBDA_APP_PATH}/lambda-trust.json
## LAMBDA_POLICY_FILE - file with definition of IAM policy lambdaFunctionPolicy for lambdaFunctionRole
export LAMBDA_POLICY_FILE=${LAMBDA_APP_PATH}/lambda-policy.json
## batch
### BATCH_NAME - app name for the current batch workload
export BATCH_NAME=${CONTAINER}
### BATCH_COMPUTE_ENVIRONMENT_NAME - name of the compute environment to submit jobs to, BATCH_COMPUTE_ENVIRONMENT_NAME=${BATCH_NAME}-compute
export BATCH_COMPUTE_ENVIRONMENT_NAME=${BATCH_NAME}-compute
### BATCH_JOB_QUEUE_NAME - name of the job queue for the current batch, BATCH_JOB_QUEUE_NAME=${BATCH_NAME}-job-queue-yyyymmdd
#export BATCH_JOB_QUEUE_NAME=${BATCH_NAME}-job-queue-$(date +%Y%m%d)
export BATCH_JOB_QUEUE_NAME=${BATCH_NAME}-job-queue
### BATCH_JOB_DEFINITION_NAME - name of the batch job definition, BATCH_JOB_DEFINITION_NAME=${BATCH_NAME}-job-definition
export BATCH_JOB_DEFINITION_NAME=${BATCH_NAME}-job-definition
### BATCH_JOB_NAME - name of the batch job, BATCH_JOB_NAME=${BATCH_NAME}-job
export BATCH_JOB_NAME=${BATCH_NAME}-job
### BATCH_COMMAND_DEFAULT - the default command to execute in the job container, BATCH_COMMAND_DEFAULT=["/job/startup.sh"]
export BATCH_COMMAND_DEFAULT="/job/startup.sh"
### BATCH_JOB_ENV_VARS - environment variables to set in the job container, BATCH_JOB_ENV_VARS="[{name=NAME1,value=VALUE1},{name=NAME2,value=VALUE2}]"
export BATCH_JOB_ENV_VARS="[{name=ITERATION_LIMIT,value=6}]"
### BATCH_MANAGE_COMPUTE_ENVIRONMENT - if true create and delete compute environment upon run or stop, if false assume compute environment exists, BATCH_MANAGE_COMPUTE_ENVIRONMENT=true|false
export BATCH_MANAGE_COMPUTE_ENVIRONMENT=true
### BATCH_JOB_VCPUS - number of vCPUs to assign to the batch job, BATCH_JOB_VCPUS=1
### The combination of VCPUS and MEMORY has to be supported according to https://docs.aws.amazon.com/cli/latest/reference/batch/register-job-definition.html
### Examples: VCPUS=0.5, MEMORY=1024,2048,3072,4096; VCPUS=1, MEMORY=2048,3072,4096,5120,6144,7168,8192
export BATCH_JOB_VCPUS=1
## BATCH_JOB_MEMORY - memory limit in MiB for the container, BATCH_JOB_MEMORY=2048
export BATCH_JOB_MEMORY=2048
### BATCH_COMPUTE_ENVIRONMENT_TYPE - type of compute to use, BATCH_COMPUTE_ENVIRONMENT_TYPE=EC2|FARGATE
export BATCH_COMPUTE_ENVIRONMENT_TYPE=EC2
### BATCH_COMPUTE_RESOURCES - compute environment configuration depending on type.
### It is assumed that a VPC already exists. Specify subnets where you would like batch jobs to run.
### Specify at least one valid security group. The vpc default security group is acceptable to use here.
### The full list of possible settings is below
### export BATCH_COMPUTE_RESOURCES="type=string,allocationStrategy=string,minvCpus=integer,maxvCpus=integer,desiredvCpus=integer,instanceTypes=string,string,imageId=string,subnets=string,string,securityGroupIds=string,string,ec2KeyPair=string,instanceRole=string,tags={KeyName1=string,KeyName2=string},placementGroup=string,bidPercentage=integer,spotIamFleetRole=string,launchTemplate={launchTemplateId=string,launchTemplateName=string,version=string},ec2Configuration=[{imageType=string,imageIdOverride=string},{imageType=string,imageIdOverride=string}]"
if [ "${BATCH_COMPUTE_ENVIRONMENT_TYPE}" == "EC2" ]; then
export BATCH_COMPUTE_RESOURCES="type=EC2,minvCpus=0,maxvCpus=256,instanceTypes=optimal,instanceRole=ecsInstanceRole,subnets=subnet-0e11612f928c54936,subnet-0003aacf876f0fac1,securityGroupIds=sg-097730877ae293efd"
else
export BATCH_COMPUTE_RESOURCES="type=FARGATE,maxvCpus=256,subnets=subnet-0e11612f928c54936,subnet-0003aacf876f0fac1,securityGroupIds=sg-097730877ae293efd"
fi