Last active
September 5, 2023 12:58
-
-
Save DocX/80e92f4c4c55d9ab6c4a to your computer and use it in GitHub Desktop.
Revisions
-
DocX revised this gist
Dec 10, 2015 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,14 +4,15 @@ CLUSTER=$1 SERVICE=$2 if [ -z "$CLUSTER" -o -z "$SERVICE" ]; then echo "Usage:" echo "ecs-console cluster-name service-name" exit 1 fi TASK_ID=$( aws ecs list-tasks --cluster=$CLUSTER --service-name=$SERVICE --output json | jq -r '.taskArns[0]' ) CONTAINER_INSTANCE_ID=$( aws ecs describe-tasks --cluster=$CLUSTER --tasks $TASK_ID --output json | jq -r '.tasks[0].containerInstanceArn' ) EC2_INSTANCE=$( aws ecs describe-container-instances --cluster=staging --container-instances $CONTAINER_INSTANCE_ID --output json | jq -r '.containerInstances[0].ec2InstanceId' ) EC2_IP=$( aws ec2 describe-instances --instance-ids $EC2_INSTANCE --output json | jq -r '.Reservations[0].Instances[0].PublicIpAddress' ) echo Connecting to: $EC2_IP -
DocX revised this gist
Nov 13, 2015 . 2 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ Requires Configure path to your ECS SSH key file ~/.bashrc echo 'export ECS_PEM_FILE=$HOME/docker.pem' >> ~/.bashrc . ~/.bashrc Run This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,10 +10,10 @@ fi TASK_ID=$( aws ecs list-tasks --cluster=$CLUSTER --service-name=$SERVICE | jq -r '.taskArns[0]' ) CONTAINER_INSTANCE_ID=$( aws ecs describe-tasks --cluster=$CLUSTER --tasks $TASK_ID | jq -r '.tasks[0].containerInstanceArn' ) EC2_INSTANCE=$( aws ecs describe-container-instances --cluster=staging --container-instances $CONTAINER_INSTANCE_ID | jq -r '.containerInstances[0].ec2InstanceId' ) EC2_IP=$( aws ec2 describe-instances --instance-ids $EC2_INSTANCE | jq -r '.Reservations[0].Instances[0].PublicIpAddress' ) echo Connecting to: $EC2_IP ssh -i $ECS_PEM_FILE ec2-user@$EC2_IP -t 'bash -c "docker exec -it $( docker ps -a -q -f name=ecs-'$SERVICE' | head -n 1 ) bash"' -
DocX revised this gist
Nov 13, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ Requires - aws-cli - https://aws.amazon.com/cli/ - jq - https://stedolan.github.io/jq/ Configure path to your ECS SSH key file ~/.bashrc echo 'ECS_PEM_FILE=$HOME/docker.pem' >> ~/.bashrc . ~/.bashrc -
DocX revised this gist
Nov 13, 2015 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,7 @@ Connect to ECS container == Requires - aws-cli - https://aws.amazon.com/cli/ - jq - https://stedolan.github.io/jq/ Configure path to your PEM file ~/.bashrc -
DocX revised this gist
Nov 13, 2015 . 2 changed files with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,11 @@ Connect to ECS container Requires - jq - https://stedolan.github.io/jq/ Configure path to your PEM file ~/.bashrc echo 'ECS_PEM_FILE=$HOME/docker.pem' >> ~/.bashrc . ~/.bashrc Run ecs-console cluster-name service-name This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -16,4 +16,4 @@ EC2_IP=$( aws ec2 describe-instances --instance-ids $EC2_INSTANCE | jq -r '.Rese echo Connecting to: $EC2_IP ssh -i $ECS_PEM_FILE ec2-user@$EC2_IP -t 'bash -c "docker exec -it $( docker ps -a -q -f name=ecs-'$SERVICE' | head -n 1 ) bash"' -
DocX revised this gist
Nov 13, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,4 +6,4 @@ Requires Run ecs-console cluster-name service-name -
DocX revised this gist
Nov 13, 2015 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,4 +5,5 @@ Requires - jq - https://stedolan.github.io/jq/ Run ecs-console cluster-name service-name -
DocX revised this gist
Nov 13, 2015 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,4 +2,7 @@ Connect to ECS container == Requires - jq - https://stedolan.github.io/jq/ Run ecs-console cluster-name service-name -
DocX revised this gist
Nov 13, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ Connect to ECS container == Requires - jq - https://stedolan.github.io/jq/ -
DocX revised this gist
Nov 13, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ Connect to ECS container ===== Requires - jq - https://stedolan.github.io/jq/ -
DocX revised this gist
Nov 13, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ == Connect to ECS container == Requires - jq - https://stedolan.github.io/jq/ -
DocX revised this gist
Nov 13, 2015 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ == ecs-console Requires - jq - https://stedolan.github.io/jq/ -
DocX revised this gist
Nov 13, 2015 . No changes.There are no files selected for viewing
-
DocX created this gist
Nov 13, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ #!/bin/bash CLUSTER=$1 SERVICE=$2 if [ -z "$CLUSTER" -o -z "$SERVICE" ]; then echo "ecs-console cluster-name service-name" exit 1 fi TASK_ID=$( aws ecs list-tasks --cluster=$CLUSTER --service-name=$SERVICE | jq -r '.taskArns[0]' ) CONTAINER_INSTANCE_ID=$( aws ecs describe-tasks --cluster=$CLUSTER --tasks $TASK_ID | jq -r '.tasks[0].containerInstanceArn' ) EC2_INSTANCE=$( aws ecs describe-container-instances --cluster=staging --container-instances $CONTAINER_INSTANCE_ID | jq -r '.containerInstances[0].ec$ EC2_IP=$( aws ec2 describe-instances --instance-ids $EC2_INSTANCE | jq -r '.Reservations[0].Instances[0].PublicIpAddress' ) echo Connecting to: $EC2_IP ssh -i $ECS_PEM_FILE ec2-user@$EC2_IP -t 'bash -c "docker exec -it $( docker ps -a -q -f name=ecs-'$SERVICE' ) bash"'