Created
May 6, 2021 17:26
-
-
Save epappas/d780734d302158ff05477a5f11ebec49 to your computer and use it in GitHub Desktop.
A simple script to convert ecs tasks to docker-compose for better understanding.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# This is a free to use, free to restribute, | |
# free to fork and free to edit software. | |
# | |
# No responsibility is granted for its use | |
# | |
# Contributors: | |
# - Evangelos Pappas <epappas@evalonlabs.com> | |
# | |
# Enjoy! | |
set -euo pipefail | |
PROFILE="" | |
REGION="" | |
TASK="" | |
for i in "$@"; do | |
case $i in | |
help) | |
echo "ecs2compose [--profile=name] [--region=name] <task_name>" | |
exit 0 | |
;; | |
--debug) | |
set -x | |
shift | |
;; | |
-p=*|--profile=*) | |
PROFILE="--profile ${i#*=}" | |
shift | |
;; | |
-r=*|--region=*) | |
REGION="--region ${i#*=}" | |
shift | |
;; | |
*) | |
TASK="${i}" | |
;; | |
esac | |
done | |
aws ecs describe-task-definition \ | |
--task-definition ${TASK} \ | |
--query taskDefinition \ | |
${PROFILE} ${REGION} | \ | |
docker run --rm -i micahhausler/container-transform \ | |
--input-type ecs --output-type compose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment