--- tags: ECS, Containers, AWS, Workshop --- # ADL Tech Series: Containers - Tips and Tricks ![alt text](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) The AWS Adelaide Tech Series brings in-person sessions to level-up your skills in key cloud domains. Meet the local team in attendance *(hover for names)* ![alt text](https://d3m889aznlr23d.cloudfront.net/img/events/id/458/458628562/assets/58403e1c344e418f20636d5a2806d3a5.arranp-high-res-current-photo.jpeg "Arran Peterson" =80x80) ![alt text](https://d3m889aznlr23d.cloudfront.net/img/events/id/458/458628562/assets/26ce144744ef9e861d846f867b833f27.adp-high-res-current-photo.jpeg "Andy Pettica" =80x80) ![alt text](https://d3m889aznlr23d.cloudfront.net/img/events/id/458/458628562/assets/9eed3888dbec81ea186fecfdacee61b9.ifal-300dpi.jpeg "Ian Falconer" =80x80) ![alt text](https://d3m889aznlr23d.cloudfront.net/img/events/id/458/458628562/assets/4a5f8328a5058437653a2d5f917c0459.joshmci-high-res-current-photo.jpeg "Josh McIntosh" =80x80) ![alt text](https://d3m889aznlr23d.cloudfront.net/img/events/id/458/458656470/assets/092abf8cac6f715907e14a6f2478bbc7.rrego-high-res-current-photo.jpeg "Rene Abrego" =80x80) ![alt text](https://d3m889aznlr23d.cloudfront.net/img/events/id/458/458716629/assets/b638e9972bf7c3929eea64e50cc671dd.karan-sethi.jpeg "Karan Sethi" =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: | Lab | Topics | Sections | Duration | |---------|-----------------------------|----------|--------| | One | Amazon ECR | All | 20 | | Two | Amazon ECS | All | 40 | | Three | Monitoring | All | 20 | | Four | Autoscaling | All | 30 | | Five | CI/CD | All | 20 | If you've reached this far, you can continue onto the Infrastructure as Code session using copilot CLI or wrap up for drinks! Don't forget the survey. # 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; `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: ``` 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 ) # What is Amazon Elastic Container Service A good place to start learning about Amazon ECS is https://aws.amazon.com/ecs/faqs/ * Getting started with Amazon Elastic Container Service: https://aws.amazon.com/ecs/getting-started/ * Official ECS tutorials: https://ecsworkshop.com/ * Re:Invent 2022 videos - Full container list https://aws.amazon.com/blogs/containers/know-before-you-go-serverless-containers-at-aws-reinvent-2022/ * Containers on the Couch ECS Playlist - Youtube Channel https://www.youtube.com/playlist?list=PLehXSATXjcQFsoMZBBFcWLUicZHdIYyhd ![alt text](https://d1.awsstatic.com/Product-Page-Diagram_Amazon-Elastic-Container-Service%402x%20march%202023.8447640b2f8c4ab0a9b935c7724cd32cfe4e6d33.png "ECS - How it works") ## 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 https://www.youtube.com/watch?v=AM7Wy8bpyL0 * re:Invent 2022 - Building containers on AWS https://youtu.be/S7JwFFZ-7_Q * ECS and AWS Resilience Hub Integration 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 ## 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 # 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 # Kubernetes What about **Elastic Kubernetes Service (EKS)**? EKS Best Practices Guides - The primary goal of this project is to offer a set of best practices for day 2 operations for Amazon EKS. We elected to publish this guidance to GitHub so we could iterate quickly, provide timely and effective recommendations for variety of concerns, and easily incorporate suggestions from the broader community https://aws.github.io/aws-eks-best-practices/ EKS Workshop - Practical exercises to learn about Amazon Elastic Kubernetes Service https://www.eksworkshop.com/docs/introduction/ **Interested in this? Chat with us about running the eksworkshop.com.**