From 27c4eabf74945cc2fc070d9e30a21ba10f3f022f Mon Sep 17 00:00:00 2001 From: Brent Langston Date: Wed, 30 Jun 2021 10:51:09 -0500 Subject: [PATCH 1/2] initial removal of ecscli --- content/cleanup/_index.md.disabled | 48 ---------- content/microservices/cleanup/_index.md | 18 +--- content/microservices/cleanup/tabs/ecscli.md | 19 ---- content/microservices/crystal/_index.md | 3 +- content/microservices/crystal/tabs/ecscli.md | 65 ------------- content/microservices/frontend/_index.md | 2 - .../frontend/tabs/ecscli-ec2-mode.md | 91 ------------------- content/microservices/frontend/tabs/ecscli.md | 91 ------------------- content/microservices/nodejs/_index.md | 3 +- .../nodejs/tabs/ecscli-ec2-mode.md | 61 ------------- content/microservices/nodejs/tabs/ecscli.md | 64 ------------- .../microservices/nodejs/tabs/ecscli.md.BAK | 61 ------------- .../platform/build_environment.md | 2 - .../microservices/platform/infrastructure.md | 6 -- content/microservices/tabs/ecscli.md | 24 ----- content/microservices/tabs/mu.md | 20 ---- 16 files changed, 3 insertions(+), 575 deletions(-) delete mode 100644 content/cleanup/_index.md.disabled delete mode 100644 content/microservices/cleanup/tabs/ecscli.md delete mode 100644 content/microservices/crystal/tabs/ecscli.md delete mode 100644 content/microservices/frontend/tabs/ecscli-ec2-mode.md delete mode 100644 content/microservices/frontend/tabs/ecscli.md delete mode 100644 content/microservices/nodejs/tabs/ecscli-ec2-mode.md delete mode 100644 content/microservices/nodejs/tabs/ecscli.md delete mode 100644 content/microservices/nodejs/tabs/ecscli.md.BAK delete mode 100644 content/microservices/tabs/ecscli.md delete mode 100644 content/microservices/tabs/mu.md diff --git a/content/cleanup/_index.md.disabled b/content/cleanup/_index.md.disabled deleted file mode 100644 index 67d91551..00000000 --- a/content/cleanup/_index.md.disabled +++ /dev/null @@ -1,48 +0,0 @@ -+++ -title = "Clean up Compute Resources." -chapter = false -weight = 10 -hidden = true -+++ - -Let's clean up our compute resources first: - - -{{%expand "Expand here to cleanup ecs cli portion of the workshop" %}} - -## Delete our compute resources, starting with the services, then ALB, then ECS Cluster, VPC, etc... -``` -cd ~/environment/ecsdemo-frontend - -ecs-cli compose --project-name ecsdemo-crystal service rm --cluster-config container-demo -ecs-cli compose --project-name ecsdemo-nodejs service rm --cluster-config container-demo -ecs-cli compose --project-name ecsdemo-frontend service rm --delete-namespace --cluster-config container-demo - -aws cloudformation delete-stack --stack-name container-demo-alb -aws cloudformation wait stack-delete-complete --stack-name container-demo-alb -aws cloudformation delete-stack --stack-name container-demo -``` -{{% /expand %}} - -{{%expand "Expand here to cleanup the cdk portion of the workshop" %}} -## Delete each service stack, and then delete the base platform stack -```bash -cd ~/environment/ecsdemo-frontend/cdk -cdk destroy -f -cd ~/environment/ecsdemo-nodejs/cdk -cdk destroy -f -cd ~/environment/ecsdemo-crystal/cdk -cdk destroy -f -cd ~/environment/container-demo/cdk -cdk destroy -f -``` -## Clean up log groups associated with services -```bash -python -c "import boto3 -c = boto3.client('logs') -services = ['ecsworkshop-frontend', 'ecsworkshop-nodejs', 'ecsworkshop-crystal', 'ecsworkshop-capacityproviders-fargate', 'ecsworkshop-capacityproviders-ec2', 'ecsworkshop-efs-fargate-demo'] -for service in services: - frontend_logs = c.describe_log_groups(logGroupNamePrefix=service) - print([c.delete_log_group(logGroupName=x['logGroupName']) for x in frontend_logs['logGroups']])" -``` -{{% /expand %}} diff --git a/content/microservices/cleanup/_index.md b/content/microservices/cleanup/_index.md index e03085ee..ee23801d 100644 --- a/content/microservices/cleanup/_index.md +++ b/content/microservices/cleanup/_index.md @@ -22,22 +22,6 @@ copilot app delete {{% /expand %}} -{{%expand "Expand here to cleanup ecs cli portion of the workshop" %}} - -## Delete our compute resources, starting with the services, then ALB, then ECS Cluster, VPC, etc... -``` -cd ~/environment/ecsdemo-frontend - -ecs-cli compose --project-name ecsdemo-crystal service rm --cluster-config container-demo -ecs-cli compose --project-name ecsdemo-nodejs service rm --cluster-config container-demo -ecs-cli compose --project-name ecsdemo-frontend service rm --delete-namespace --cluster-config container-demo - -aws cloudformation delete-stack --stack-name container-demo-alb -aws cloudformation wait stack-delete-complete --stack-name container-demo-alb -aws cloudformation delete-stack --stack-name container-demo -``` -{{% /expand %}} - {{%expand "Expand here to cleanup the cdk portion of the workshop" %}} ## Delete each service stack, and then delete the base platform stack ```bash @@ -59,4 +43,4 @@ for service in services: frontend_logs = c.describe_log_groups(logGroupNamePrefix=service) print([c.delete_log_group(logGroupName=x['logGroupName']) for x in frontend_logs['logGroups']])" ``` -{{% /expand %}} \ No newline at end of file +{{% /expand %}} diff --git a/content/microservices/cleanup/tabs/ecscli.md b/content/microservices/cleanup/tabs/ecscli.md deleted file mode 100644 index 3982a04a..00000000 --- a/content/microservices/cleanup/tabs/ecscli.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "Embedded tab content" -disableToc: true -hidden: true ---- - -## Delete our compute resources, starting with the services, then ALB, then ECS Cluster, VPC, etc... -``` -cd ~/environment/ecsdemo-frontend - -ecs-cli compose --project-name ecsdemo-crystal service rm --cluster-config container-demo -ecs-cli compose --project-name ecsdemo-nodejs service rm --cluster-config container-demo -ecs-cli compose --project-name ecsdemo-frontend service rm --delete-namespace --cluster-config container-demo - -aws cloudformation delete-stack --stack-name container-demo-alb -aws cloudformation wait stack-delete-complete --stack-name container-demo-alb -aws cloudformation delete-stack --stack-name container-demo - -``` diff --git a/content/microservices/crystal/_index.md b/content/microservices/crystal/_index.md index 60123717..af8368fb 100644 --- a/content/microservices/crystal/_index.md +++ b/content/microservices/crystal/_index.md @@ -10,5 +10,4 @@ pre: ' ' {{< tabs name="Deploy Crystal Service" >}} {{< tab name="copilot-cli" include="tabs/copilot.md" />}} {{< tab name="cdk" include="tabs/cdk.md" />}} -{{< tab name="ecs-cli fargate mode" include="tabs/ecscli.md" />}} -{{< /tabs >}} \ No newline at end of file +{{< /tabs >}} diff --git a/content/microservices/crystal/tabs/ecscli.md b/content/microservices/crystal/tabs/ecscli.md deleted file mode 100644 index fb3f2fa8..00000000 --- a/content/microservices/crystal/tabs/ecscli.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: "Embedded tab content" -disableToc: true -hidden: true ---- - - -Let’s bring up the Crystal Backend API! - -## Deploy our crystal application: -``` -cd ~/environment/ecsdemo-crystal -envsubst < ecs-params.yml.template >ecs-params.yml - -ecs-cli compose --project-name ecsdemo-crystal service up \ - --create-log-groups \ - --private-dns-namespace service \ - --enable-service-discovery \ - --cluster-config container-demo \ - --vpc $vpc - -``` -Here, we change directories into our crystal application code directory. -The `envsubst` command templates our `ecs-params.yml` file with our current values. -We then launch our crystal service on our ECS cluster (with a default launchtype -of Fargate) - -Note: ecs-cli will take care of building our private dns namespace for service discovery, -and log group in cloudwatch logs. - -## View running container, and store the output of the task id as an env variable for later use: -``` -ecs-cli compose --project-name ecsdemo-crystal service ps \ - --cluster-config container-demo - -task_id=$(ecs-cli compose --project-name ecsdemo-crystal service ps --cluster-config container-demo | awk -F \/ 'FNR == 2 {print $2}') -``` -We should have one task registered. - -## Check reachability (open url in your browser): -``` -alb_url=$(aws cloudformation describe-stacks --stack-name container-demo-alb --query 'Stacks[0].Outputs[?OutputKey==`ExternalUrl`].OutputValue' --output text) -echo "Open $alb_url in your browser" -``` -This command looks up the URL for our ingress ALB, and outputs it. You should -be able to click to open, or copy-paste into your browser. - -## View logs: -``` -# Referencing task id from above ps command -ecs-cli logs --task-id $task_id \ - --follow --cluster-config container-demo -``` -To view logs, find the task id from the earlier `ps` command, and use it in this -command. You can follow a task's logs also. - -## Scale the tasks: -``` -ecs-cli compose --project-name ecsdemo-crystal service scale 3 \ - --cluster-config container-demo -ecs-cli compose --project-name ecsdemo-crystal service ps \ - --cluster-config container-demo -``` -We can see that our containers have now been evenly distributed across all 3 of our -availability zones. diff --git a/content/microservices/frontend/_index.md b/content/microservices/frontend/_index.md index 11abba2c..f74cde82 100644 --- a/content/microservices/frontend/_index.md +++ b/content/microservices/frontend/_index.md @@ -10,6 +10,4 @@ pre: ' ' {{< tabs name="Deploy Frontend" >}} {{< tab name="copilot-cli" include="tabs/copilot.md" />}} {{< tab name="cdk" include="tabs/cdk.md" />}} -{{< tab name="ecs-cli fargate mode" include="tabs/ecscli.md" />}} -{{< tab name="ecs-cli ec2 mode" include="tabs/ecscli-ec2-mode.md" />}} {{< /tabs >}} diff --git a/content/microservices/frontend/tabs/ecscli-ec2-mode.md b/content/microservices/frontend/tabs/ecscli-ec2-mode.md deleted file mode 100644 index fc7decb4..00000000 --- a/content/microservices/frontend/tabs/ecscli-ec2-mode.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: "Embedded tab content" -disableToc: true -hidden: true ---- - -## Set environment variables from our build -``` -export clustername=$(aws cloudformation describe-stacks --stack-name container-demo --query 'Stacks[0].Outputs[?OutputKey==`ClusterName`].OutputValue' --output text) -export target_group_arn=$(aws cloudformation describe-stack-resources --stack-name container-demo-alb | jq -r '.[][] | select(.ResourceType=="AWS::ElasticLoadBalancingV2::TargetGroup").PhysicalResourceId') -export vpc=$(aws cloudformation describe-stacks --stack-name container-demo --query 'Stacks[0].Outputs[?OutputKey==`VpcId`].OutputValue' --output text) -export ecsTaskExecutionRole=$(aws cloudformation describe-stacks --stack-name container-demo --query 'Stacks[0].Outputs[?OutputKey==`ECSTaskExecutionRole`].OutputValue' --output text) -export subnet_1=$(aws cloudformation describe-stacks --stack-name container-demo --query 'Stacks[0].Outputs[?OutputKey==`PrivateSubnetOne`].OutputValue' --output text) -export subnet_2=$(aws cloudformation describe-stacks --stack-name container-demo --query 'Stacks[0].Outputs[?OutputKey==`PrivateSubnetTwo`].OutputValue' --output text) -export subnet_3=$(aws cloudformation describe-stacks --stack-name container-demo --query 'Stacks[0].Outputs[?OutputKey==`PrivateSubnetThree`].OutputValue' --output text) -export security_group=$(aws cloudformation describe-stacks --stack-name container-demo --query 'Stacks[0].Outputs[?OutputKey==`ContainerSecurityGroup`].OutputValue' --output text) - -cd ~/environment -``` - -## Configure `ecs-cli` to talk to your cluster: -``` -ecs-cli configure --region $AWS_REGION --cluster $clustername --default-launch-type EC2 --config-name container-demo -``` -We set a default region so we can reference the region when we run our commands. - -## Authorize traffic: -``` -aws ec2 authorize-security-group-ingress --group-id "$security_group" --protocol tcp --port 3000 --source-group "$security_group" -``` -We know that our containers talk on port 3000, so authorize that traffic on our security group: - -## Deploy our frontend application: -``` -cd ~/environment/ecsdemo-frontend -envsubst < ecs-params.yml.template >ecs-params.yml - -ecs-cli compose --project-name ecsdemo-frontend service up \ - --create-log-groups \ - --target-group-arn $target_group_arn \ - --private-dns-namespace service \ - --enable-service-discovery \ - --container-name ecsdemo-frontend \ - --container-port 3000 \ - --cluster-config container-demo \ - --vpc $vpc - -``` -Here, we change directories into our frontend application code directory. -The `envsubst` command templates our `ecs-params.yml` file with our current values. -We then launch our frontend service on our ECS cluster (with a default launchtype -of Fargate) - -Note: ecs-cli will take care of building our private dns namespace for service discovery, -and log group in cloudwatch logs. - -## View running container, and store the output of the task id as an env variable for later use: -``` -ecs-cli compose --project-name ecsdemo-frontend service ps \ - --cluster-config container-demo - -task_id=$(ecs-cli compose --project-name ecsdemo-frontend service ps --cluster-config container-demo | awk -F \/ 'FNR == 2 {print $2}') -``` -We should have one task registered. - -## Check reachability (open url in your browser): -``` -alb_url=$(aws cloudformation describe-stacks --stack-name container-demo-alb --query 'Stacks[0].Outputs[?OutputKey==`ExternalUrl`].OutputValue' --output text) -echo "Open $alb_url in your browser" -``` -This command looks up the URL for our ingress ALB, and outputs it. You should -be able to click to open, or copy-paste into your browser. - -## View logs: -``` -# Referencing task id from above ps command -ecs-cli logs --task-id $task_id \ - --follow --cluster-config container-demo -``` -To view logs, find the task id from the earlier `ps` command, and use it in this -command. You can follow a task's logs also. - -## Scale the tasks: -``` -ecs-cli compose --project-name ecsdemo-frontend service scale 3 \ - --cluster-config container-demo -ecs-cli compose --project-name ecsdemo-frontend service ps \ - --cluster-config container-demo -``` -We can see that our containers have now been evenly distributed across all 3 of our -availability zones. diff --git a/content/microservices/frontend/tabs/ecscli.md b/content/microservices/frontend/tabs/ecscli.md deleted file mode 100644 index 59c72857..00000000 --- a/content/microservices/frontend/tabs/ecscli.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: "Embedded tab content" -disableToc: true -hidden: true ---- - -## Set environment variables from our build -``` -export clustername=$(aws cloudformation describe-stacks --stack-name container-demo --query 'Stacks[0].Outputs[?OutputKey==`ClusterName`].OutputValue' --output text) -export target_group_arn=$(aws cloudformation describe-stack-resources --stack-name container-demo-alb | jq -r '.[][] | select(.ResourceType=="AWS::ElasticLoadBalancingV2::TargetGroup").PhysicalResourceId') -export vpc=$(aws cloudformation describe-stacks --stack-name container-demo --query 'Stacks[0].Outputs[?OutputKey==`VpcId`].OutputValue' --output text) -export ecsTaskExecutionRole=$(aws cloudformation describe-stacks --stack-name container-demo --query 'Stacks[0].Outputs[?OutputKey==`ECSTaskExecutionRole`].OutputValue' --output text) -export subnet_1=$(aws cloudformation describe-stacks --stack-name container-demo --query 'Stacks[0].Outputs[?OutputKey==`PrivateSubnetOne`].OutputValue' --output text) -export subnet_2=$(aws cloudformation describe-stacks --stack-name container-demo --query 'Stacks[0].Outputs[?OutputKey==`PrivateSubnetTwo`].OutputValue' --output text) -export subnet_3=$(aws cloudformation describe-stacks --stack-name container-demo --query 'Stacks[0].Outputs[?OutputKey==`PrivateSubnetThree`].OutputValue' --output text) -export security_group=$(aws cloudformation describe-stacks --stack-name container-demo --query 'Stacks[0].Outputs[?OutputKey==`ContainerSecurityGroup`].OutputValue' --output text) - -cd ~/environment -``` - -## Configure `ecs-cli` to talk to your cluster: -``` -ecs-cli configure --region $AWS_REGION --cluster $clustername --default-launch-type FARGATE --config-name container-demo -``` -We set a default region so we can reference the region when we run our commands. - -## Authorize traffic: -``` -aws ec2 authorize-security-group-ingress --group-id "$security_group" --protocol tcp --port 3000 --source-group "$security_group" -``` -We know that our containers talk on port 3000, so authorize that traffic on our security group: - -## Deploy our frontend application: -``` -cd ~/environment/ecsdemo-frontend -envsubst < ecs-params.yml.template >ecs-params.yml - -ecs-cli compose --project-name ecsdemo-frontend service up \ - --create-log-groups \ - --target-group-arn $target_group_arn \ - --private-dns-namespace service \ - --enable-service-discovery \ - --container-name ecsdemo-frontend \ - --container-port 3000 \ - --cluster-config container-demo \ - --vpc $vpc - -``` -Here, we change directories into our frontend application code directory. -The `envsubst` command templates our `ecs-params.yml` file with our current values. -We then launch our frontend service on our ECS cluster (with a default launchtype -of Fargate) - -Note: ecs-cli will take care of building our private dns namespace for service discovery, -and log group in cloudwatch logs. - -## View running container, and store the output of the task id as an env variable for later use: -``` -ecs-cli compose --project-name ecsdemo-frontend service ps \ - --cluster-config container-demo - -task_id=$(ecs-cli compose --project-name ecsdemo-frontend service ps --cluster-config container-demo | awk -F \/ 'FNR == 2 {print $2}') -``` -We should have one task registered. - -## Check reachability (open url in your browser): -``` -alb_url=$(aws cloudformation describe-stacks --stack-name container-demo-alb --query 'Stacks[0].Outputs[?OutputKey==`ExternalUrl`].OutputValue' --output text) -echo "Open $alb_url in your browser" -``` -This command looks up the URL for our ingress ALB, and outputs it. You should -be able to click to open, or copy-paste into your browser. - -## View logs: -``` -# Referencing task id from above ps command -ecs-cli logs --task-id $task_id \ - --follow --cluster-config container-demo -``` -To view logs, find the task id from the earlier `ps` command, and use it in this -command. You can follow a task's logs also. - -## Scale the tasks: -``` -ecs-cli compose --project-name ecsdemo-frontend service scale 3 \ - --cluster-config container-demo -ecs-cli compose --project-name ecsdemo-frontend service ps \ - --cluster-config container-demo -``` -We can see that our containers have now been evenly distributed across all 3 of our -availability zones. diff --git a/content/microservices/nodejs/_index.md b/content/microservices/nodejs/_index.md index 27654826..e875f4f8 100644 --- a/content/microservices/nodejs/_index.md +++ b/content/microservices/nodejs/_index.md @@ -10,5 +10,4 @@ pre: ' ' {{< tabs name="Deploy Frontend" >}} {{< tab name="copilot-cli" include="tabs/copilot.md" />}} {{< tab name="cdk" include="tabs/cdk.md" />}} -{{< tab name="ecs-cli fargate mode" include="tabs/ecscli.md" />}} -{{< /tabs >}} \ No newline at end of file +{{< /tabs >}} diff --git a/content/microservices/nodejs/tabs/ecscli-ec2-mode.md b/content/microservices/nodejs/tabs/ecscli-ec2-mode.md deleted file mode 100644 index 2bd83bb5..00000000 --- a/content/microservices/nodejs/tabs/ecscli-ec2-mode.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: "Embedded tab content" -disableToc: true -hidden: true ---- - -## Deploy our NodeJS Backend Application: -``` -cd ~/environment/ecsdemo-nodejs -envsubst < ecs-params.yml.template >ecs-params.yml - -ecs-cli compose --project-name ecsdemo-nodejs service up \ - --create-log-groups \ - --private-dns-namespace service \ - --enable-service-discovery \ - --cluster-config fargate-demo \ - --vpc $vpc - -``` -Here, we change directories into our nodejs application code directory. -The `envsubst` command templates our `ecs-params.yml` file with our current values. -We then launch our nodejs service on our ECS cluster (with a default launchtype -of Fargate) - -Note: ecs-cli will take care of building our private dns namespace for service discovery, -and log group in cloudwatch logs. - -## View running container: -``` -ecs-cli compose --project-name ecsdemo-nodejs service ps \ - --cluster-config fargate-demo -``` -We should have one task registered. - -## Check reachability (open url in your browser): -``` -alb_url=$(aws cloudformation describe-stacks --stack-name fargate-demo-alb --query 'Stacks[0].Outputs[?OutputKey==`ExternalUrl`].OutputValue' --output text) -echo "Open $alb_url in your browser" -``` -This command looks up the URL for our ingress ALB, and outputs it. You should -be able to click to open, or copy-paste into your browser. - -## View logs: -``` -#substitute your task id from the ps command -ecs-cli logs --task-id a06a6642-12c5-4006-b1d1-033994580605 \ - --follow --cluster-config fargate-demo -``` -To view logs, find the task id from the earlier `ps` command, and use it in this -command. You can follow a task's logs also. - -## Scale the tasks: -``` -ecs-cli compose --project-name ecsdemo-nodejs service scale 3 \ - --cluster-config fargate-demo -ecs-cli compose --project-name ecsdemo-nodejs service ps \ - --cluster-config fargate-demo -``` -We can see that our containers have now been evenly distributed across all 3 of our -availability zones. - diff --git a/content/microservices/nodejs/tabs/ecscli.md b/content/microservices/nodejs/tabs/ecscli.md deleted file mode 100644 index c8793564..00000000 --- a/content/microservices/nodejs/tabs/ecscli.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: "Acceptance and Production" -disableToc: true -hidden: true ---- - -Let’s bring up the NodeJS Backend API! - -## Deploy our NodeJS Backend Application: -``` -cd ~/environment/ecsdemo-nodejs -envsubst < ecs-params.yml.template >ecs-params.yml - -ecs-cli compose --project-name ecsdemo-nodejs service up \ - --create-log-groups \ - --private-dns-namespace service \ - --enable-service-discovery \ - --cluster-config container-demo \ - --vpc $vpc - -``` -Here, we change directories into our nodejs application code directory. -The `envsubst` command templates our `ecs-params.yml` file with our current values. -We then launch our nodejs service on our ECS cluster (with a default launchtype -of Fargate) - -Note: ecs-cli will take care of building our private dns namespace for service discovery, -and log group in cloudwatch logs. - -## View running container, and store the output of the task id as an env variable for later use: -``` -ecs-cli compose --project-name ecsdemo-nodejs service ps \ - --cluster-config container-demo - -task_id=$(ecs-cli compose --project-name ecsdemo-nodejs service ps --cluster-config container-demo | awk -F \/ 'FNR == 2 {print $2}') -``` -We should have one task registered. - -## Check reachability (open url in your browser): -``` -alb_url=$(aws cloudformation describe-stacks --stack-name container-demo-alb --query 'Stacks[0].Outputs[?OutputKey==`ExternalUrl`].OutputValue' --output text) -echo "Open $alb_url in your browser" -``` -This command looks up the URL for our ingress ALB, and outputs it. You should -be able to click to open, or copy-paste into your browser. - -## View logs: -``` -# Referencing task id from above ps command -ecs-cli logs --task-id $task_id \ - --follow --cluster-config container-demo -``` -To view logs, find the task id from the earlier `ps` command, and use it in this -command. You can follow a task's logs also. - -## Scale the tasks: -``` -ecs-cli compose --project-name ecsdemo-nodejs service scale 3 \ - --cluster-config container-demo -ecs-cli compose --project-name ecsdemo-nodejs service ps \ - --cluster-config container-demo -``` -We can see that our containers have now been evenly distributed across all 3 of our -availability zones. diff --git a/content/microservices/nodejs/tabs/ecscli.md.BAK b/content/microservices/nodejs/tabs/ecscli.md.BAK deleted file mode 100644 index 2bd83bb5..00000000 --- a/content/microservices/nodejs/tabs/ecscli.md.BAK +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: "Embedded tab content" -disableToc: true -hidden: true ---- - -## Deploy our NodeJS Backend Application: -``` -cd ~/environment/ecsdemo-nodejs -envsubst < ecs-params.yml.template >ecs-params.yml - -ecs-cli compose --project-name ecsdemo-nodejs service up \ - --create-log-groups \ - --private-dns-namespace service \ - --enable-service-discovery \ - --cluster-config fargate-demo \ - --vpc $vpc - -``` -Here, we change directories into our nodejs application code directory. -The `envsubst` command templates our `ecs-params.yml` file with our current values. -We then launch our nodejs service on our ECS cluster (with a default launchtype -of Fargate) - -Note: ecs-cli will take care of building our private dns namespace for service discovery, -and log group in cloudwatch logs. - -## View running container: -``` -ecs-cli compose --project-name ecsdemo-nodejs service ps \ - --cluster-config fargate-demo -``` -We should have one task registered. - -## Check reachability (open url in your browser): -``` -alb_url=$(aws cloudformation describe-stacks --stack-name fargate-demo-alb --query 'Stacks[0].Outputs[?OutputKey==`ExternalUrl`].OutputValue' --output text) -echo "Open $alb_url in your browser" -``` -This command looks up the URL for our ingress ALB, and outputs it. You should -be able to click to open, or copy-paste into your browser. - -## View logs: -``` -#substitute your task id from the ps command -ecs-cli logs --task-id a06a6642-12c5-4006-b1d1-033994580605 \ - --follow --cluster-config fargate-demo -``` -To view logs, find the task id from the earlier `ps` command, and use it in this -command. You can follow a task's logs also. - -## Scale the tasks: -``` -ecs-cli compose --project-name ecsdemo-nodejs service scale 3 \ - --cluster-config fargate-demo -ecs-cli compose --project-name ecsdemo-nodejs service ps \ - --cluster-config fargate-demo -``` -We can see that our containers have now been evenly distributed across all 3 of our -availability zones. - diff --git a/content/microservices/platform/build_environment.md b/content/microservices/platform/build_environment.md index 2b5faa77..d88c0d7b 100644 --- a/content/microservices/platform/build_environment.md +++ b/content/microservices/platform/build_environment.md @@ -25,7 +25,5 @@ session-manager-plugin {{< tabs name="Build the environments" >}} {{< tab name="copilot-cli" include="tabs/copilot.md" />}} {{< tab name="cdk" include="tabs/cdk.md" />}} -{{< tab name="ecs-cli fargate mode" include="tabs/ecscli.md" />}} -{{< tab name="ecs-cli ec2 mode" include="tabs/ecscli-ec2-mode.md" />}} {{< /tabs >}} diff --git a/content/microservices/platform/infrastructure.md b/content/microservices/platform/infrastructure.md index 57541e0b..bca439f5 100644 --- a/content/microservices/platform/infrastructure.md +++ b/content/microservices/platform/infrastructure.md @@ -23,10 +23,4 @@ This repository will build the baseline platform for the microservices to deploy We will be continue using the AWS CDK to deploy our applications into this cluster. {{% /expand %}} -{{%expand "ecs-cli path" %}} -This repository will use 2 CloudFormation Stacks that will build our cluster environment and ALB. - -We will then use ecs-cli to deploy our applications into this cluster. -{{% /expand %}} - ![mu-environment](/images/mu-topology-vpc.png) diff --git a/content/microservices/tabs/ecscli.md b/content/microservices/tabs/ecscli.md deleted file mode 100644 index 323ef6ab..00000000 --- a/content/microservices/tabs/ecscli.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: "Embedded tab content" -disableToc: true -hidden: true ---- - -- First install the ECS cli (plus some other text utilities): - -``` -sudo curl -so /usr/local/bin/ecs-cli https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-latest -sudo chmod +x /usr/local/bin/ecs-cli - -sudo yum -y install jq gettext -``` - -- Next configure the AWS cli with our current region as default: - -``` -export AWS_REGION=$(curl -s 169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region) -echo "export AWS_REGION=${AWS_REGION}" >> ~/.bash_profile -aws configure set default.region ${AWS_REGION} -aws configure get default.region -``` - diff --git a/content/microservices/tabs/mu.md b/content/microservices/tabs/mu.md deleted file mode 100644 index 8944dd2a..00000000 --- a/content/microservices/tabs/mu.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "Embedded tab content" -disableToc: true -hidden: true ---- - -``` -curl -s https://getmu.io/install.sh | sudo sh -``` - -We should set a namespace so that multiple IAM users can run -this workshop in the same AWS account. - -We will pick a random two character string and save it to our environment: - -``` -export MU_NAMESPACE="mu-$(uuidgen -r | cut -c1-2)" -echo "export MU_NAMESPACE=$MU_NAMESPACE" >> ~/.bashrc -echo "My namespace is $MU_NAMESPACE" -``` \ No newline at end of file From 29c669858db511b244df6880114d0653f4279568 Mon Sep 17 00:00:00 2001 From: Brent Langston Date: Wed, 30 Jun 2021 10:58:29 -0500 Subject: [PATCH 2/2] missed a reference --- content/microservices/software.md | 1 - 1 file changed, 1 deletion(-) diff --git a/content/microservices/software.md b/content/microservices/software.md index 20b8631e..8f9036c5 100644 --- a/content/microservices/software.md +++ b/content/microservices/software.md @@ -9,7 +9,6 @@ In the Cloud9 workspace, run the following commands (note: choose one installati {{< tabs name="install software" >}} {{< tab name="copilot-cli" include="tabs/copilot.md" />}} {{< tab name="cdk" include="tabs/cdk.md" />}} -{{< tab name="ecscli" include="tabs/ecscli.md" />}} {{< /tabs >}}