--- tags: ECS, Containers, AWS, Workshop --- # Customer: ECS Containers Day :::info :warning: This event is now completed. Post workshop follow items have been added. [click on this link](#Post-Workshop-Follow-Up-Items) ::: ![AWS Workshop](https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/main/source/unofficial/AWS-Architecture-Icons_SVG_20200430/SVG%20Light/_Group%20Icons/AWS-Cloud-alt_light-bg.svg "Tech Series" =20x20) Meet the local team in attendance *(hover for names)* ![Arran Peterson](https://d3m889aznlr23d.cloudfront.net/img/events/id/458/458628562/assets/58403e1c344e418f20636d5a2806d3a5.arranp-high-res-current-photo.jpeg "Arran Peterson" =80x80) ![Luke N](https://d3m889aznlr23d.cloudfront.net/img/events/id/458/458628562/assets/8017d0b1195a9d57f1b44457f03b329f.lnotley-high-res-current-photo.jpeg "Luke Notley" =80x80) This is our list of hints and tips for this workshop. **JOIN EVENT:** https://catalog.workshops.aws/join 1. Complete OTP to an email address (Any that you can access over public internet) 2. **Code will be on the TV** screen for you to type. 3. Read "Terms and Conditions", select "**I agree with the Terms and Conditions**" and click "**Join event**". 4. On the next page, click "**Open AWS Console**" URL link. ![](https://hackmd.io/_uploads/SycdQF8P3.png) 3. **Skip the entire section**: "Before starting the workshop..." *this is already done!* 4. Go straight to the first lab [**Deploy With AWS Console**](https://catalog.us-east-1.prod.workshops.aws/workshops/8c9036a7-7564-434c-b558-3588754e21f5/en-US/03-console) # Administrivia, Schedule and Planning The event will be delivered as follows: | Activity | Topics | Sections | Duration | Start Time | |---------|-----------------------------|----------|--------|---------| | Coffee! | Welcome :coffee: | -- | 30 | 9:00 | | **Pres** | **ECS Deep Dive** | -- | 60 | 9:30 | | Lab One | Amazon ECR | All | 20 | 10:30 | | Lab Two | Amazon ECS | All | 40 | 10:50 | | Lab Three | Monitoring | All | 30 | 11:30 | | Lunch! | Food Provided :sandwich: | -- | 30 | 12:00 | | **Pres** | **Network & Security** | -- | 30 | 12:30 | | Lab Four | Autoscaling | All | 30 | 1:00 | | **Demo** | **Spot** | -- | 30 | 1:30 | | **Pres** | **Scaling** | -- | 30 | 2:00 | | Lab Five | CI/CD | All | 30 | 2:30 | | Lab Six | IaC | All | 30 | 3:00 | | **Demo** | ECS WA Lens | -- | 30 | 3:30 | If you've reached this far, you can continue with either: 1. **ECS - Spot Capacity Provider** - [Learn how to burst to Spot on EC2 and Fargate](https://hackmd.io/@arranp/ryl4xq902). 1. **ECS - Task Placement Constraints** - [Learn how to deploy tasks to specific hardware requirements.](https://hackmd.io/@arranp/rkPKdM9R3) 2. **ECS - ECS Service Connect** - [Learn how to perform inter service communication.](https://hackmd.io/@arranp/SyUOi4pAh) 3. **ECS - Seekable OCI with AWS Fargate** - Learn how to generate lazy loading images with ECR and run on ECS Fargate. {COMING SOON} or wrap up for drinks! Don't forget the survey. ![](https://hackmd.io/_uploads/SJEn9lJya.png) # Cats and Dogs Labs Refer to the following headings when working through the content and getting stuck. ## Auto Scaling > Service Auto Scale > Service Load Test The load test example looks like this; `siege -c 200 -i [Your ALB DNS name] + '/'` this should be interpreted with your DNS ELB name like the following; `siege -c 200 -i http://demogo-alb-1631020000.us-west-2.elb.amazonaws.com/` **NOTE**: Make sure that '/' is at the end of the ALB DNS name, because the web service is bound to the default path (/). Without it, the traffic burst will not hit our web application ## Auto Scaling > Cluster Auto Scale > Cluster Load Test The load test example looks like this; `siege -c 500 -i [Your ALB DNS name] + /` You will get warning message from siege saying it can only do 255 concurrent sessions without changing a configuration file. This will be enough to force a scaling event in the cluster. Continue with the test. ## CI/CD > AWS CodeCommit If you don't see any files give the UI 1-2 minutes to catch up on the first push. ## CI/CD > CodePipeline Setting ### Get Account Information If you do not know how to get your `<YOUR REGION>` and `<YOUR ACCOUNT ID>`, then perform the following in the Cloud9 terminal; ```bash= echo ${AWS_REGION} && echo ${AWS_ACCOUNT_ID} ``` Update your build spec lines `7` & `8`, then save the file. ### Build Step Failure Check 1 - Review the build logs If your build step fails, make sure you have updated the IAM role to include the required permissions and then retry the step. Check 2 - Review the build logs Check if your buildspec.yml has been pushed to your repository using cloud9. > [Container] 2023/06/06 02:55:00 Phase context status code: YAML_FILE_ERROR Message: YAML file does not exist If it hasn't perform the following in Cloud9 terminal: ```bash= cd ~/environment/dogs git add buildspec.yml git commit -m "add buildspec.yml" git push ``` Navigate back to the *dogs-cicd* Pipeline you will see the Build is 'in progress', this is because it has been triggered by the source repository event from the *git push* in the previous step. ![](https://hackmd.io/_uploads/Hk7YGm2L2.png ) ## CI/CD Deploy Test You may notice that index.html has changed since the last revision of the workshop. The column 17 doesn't match where the H1 tag is. Instead update the H1 tag on column 23 ![](https://hackmd.io/_uploads/rkM_mQhL2.png ) --- **This is the end of the workshop material** the rest of this page is dedicated to useful links and best practices for Amazon ECS that I find useful for sharing with customers. It gets updated over time. --- # Post-Workshop Follow Up Items This section has specific follow up items for the LastYard team. **Troubleshooting** * Access EC2 ECS Container Instances for rudimentary troubleshooting via System Manager https://hackmd.io/@arranp/By9vvpG1p * Get an interactive session on a running task with Fargate or ECS on EC2 using ECS Exec. https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-exec.html **ECR** * Adding synchronous vulnerability scanning on push to ECR to stop container builds with critical vulnerabilities. https://hackmd.io/@arranp/B17X6of1T **Observability** * Observability Task Definition Examples https://docs.aws.amazon.com/AmazonECS/latest/developerguide/firelens-example-taskdefs.html#firelens-example-opensearch https://github.com/aws-samples/amazon-ecs-firelens-examples **Container Security** * Containers on the Couch is my favourite Twitch show, same day as our gig they talked about BottleRocket OS! :movie_camera: https://www.youtube.com/live/iiyOKqeDqbo?si=yJCHe4LnjspVUbzF **CI/CD** * AWS CodeDeploy now supports linear and canary deployments for Amazon ECS https://aws.amazon.com/blogs/containers/aws-codedeploy-now-supports-linear-and-canary-deployments-for-amazon-ecs/ * Blue/Green Deployments on ECS :movie_camera: https://www.youtube.com/watch?v=DZ5eePBq74A&t=2246s ## ECS Best Practices Best Practices - Running your application with Amazon ECS https://docs.aws.amazon.com/AmazonECS/latest/bestpracticesguide/application.html Well Architected - Container Build Lens https://docs.aws.amazon.com/wellarchitected/latest/container-build-lens/container-build-lens.html **ECS Lens - Well Architected Tool coming soon!** ## Container Optimisation General community guidance on container optimisation * Containers on the Counch - Container optimization strategy :movie_camera: https://www.youtube.com/watch?v=AM7Wy8bpyL0 * re:Invent 2022 - Building containers on AWS :movie_camera: https://youtu.be/S7JwFFZ-7_Q * ECS and AWS Resilience Hub Integration :movie_camera: https://www.youtube.com/watch?v=9GUZzAfuCOs * AWS Fargate right sizing dashboard (Oct 22) https://github.com/mreferre/container-insights-custom-dashboards/tree/master/fargate-right-sizing * AWS Fargate Enables Faster Container Startup using Seekable OCI https://aws.amazon.com/blogs/aws/aws-fargate-enables-faster-container-startup-using-seekable-oci/ * Amazon ECS Finhack Workshop https://catalog.us-east-1.prod.workshops.aws/workshops/4a04c5d0-6750-417c-a190-cbeb941fb664/en-US ## Migration Migration tools and strategies * AWS App2Container for Java and .NET https://aws.amazon.com/app2container/ * Porting Assistant for .NET https://aws.amazon.com/porting-assistant-dotnet/ * AWS Microservice Extractor for .NET https://aws.amazon.com/microservice-extractor/ * AWS Prescriptive Guidance - The strangler fig pattern https://docs.aws.amazon.com/prescriptive-guidance/latest/modernization-aspnet-web-services/fig-pattern.html * Migration Hub - Refactor Spaces https://aws.amazon.com/migration-hub/features/?nc=sn&loc=2#Incremental_app_refactoring **Interested in these? Chat with us about the App2Container Workshop which includes Refactor Spaces.** https://catalog.us-east-1.prod.workshops.aws/workshops/2c1e5f50-0ebe-4c02-a957-8a71ba1e8c89/en-US ## Operations Operational day 2 tasks * Autoscaling Deep Dive https://aws.amazon.com/blogs/containers/deep-dive-on-amazon-ecs-cluster-auto-scaling/ * Re-balancing ECS Tasks https://github.com/aws-samples/ecs-refarch-task-rebalancing * Gatecheck enables users to define, check, and enforce policies on ECS tasks. https://arvindsoni80.github.io/gatecheck/architecture/ * Do's and Don'ts with AWS Batch https://aws.amazon.com/blogs/hpc/aws-batch-best-practices/ * Simplifying Amazon ECS monitoring set up with AWS Distro for OpenTelemetry https://aws.amazon.com/blogs/opensource/simplifying-amazon-ecs-monitoring-set-up-with-aws-distro-for-opentelemetry/ * Setting up AWS Distro for OpenTelemetry Collector in Amazon Elastic Container Service https://aws-otel.github.io/docs/setup/ecs * AWS CodeDeploy now supports linear and canary deployments for Amazon ECS https://aws.amazon.com/blogs/containers/aws-codedeploy-now-supports-linear-and-canary-deployments-for-amazon-ecs/ * Bottlerocket ECS Updater https://github.com/bottlerocket-os/bottlerocket-ecs-updater # Case Study * Fire TV at Amazon Prime Video Modernizes Its Stack Using Amazon ECS with AWS Fargate https://aws.amazon.com/solutions/case-studies/amazon-prime-video-ecs-case-study/ # Self Paced Learning Badges & Training - .NET on AWS https://aws.amazon.com/developer/language/net/badges-and-training/ AWS Ramp-Up Guide - Containers https://d1.awsstatic.com/training-and-certification/ramp-up_guides/Ramp-Up_Guide_Containers.pdf AWS Skill Builder - Containers Learning Path https://explore.skillbuilder.aws/learn/public/learning_plan/view/83/containers-learning-plan