#aws (2024-09)

aws Discussion related to Amazon Web Services (AWS)

aws Discussion related to Amazon Web Services (AWS)

Archive: https://archive.sweetops.com/aws/

2024-09-02

Emmanuel O avatar
Emmanuel O

Hello, I’m currently facing an issue with aws load balancer. I have an ecs fargate cluster with about five tasks. However, I noticed that these instances dont scale pass 10 users during a load test. Upon further debugging, I had to ssh into each of these instances and did a htop to see the cpu and memory utilization of these five tasks. I noticed that one of these tasks had 100% cpu utilization and the rest had no cpu utilization. This makes the cpu utilization get very high and makes the ecs tasks unhealthy and unable to receive more traffic. This image shows the ecs cpu utilization for one instance. How can i ensure this traffic is evenly distributing the traffic to all tasks in the ecs service. Upon checking my load balancer access logs, I also noticed that a lot of requests came from one ip address. I tried modifying the load balancer traffic distribution style to round robin but it still doesnt distribute traffic evenly across all my tasks. What can I do to ensure scalability of my application? Has anyone faced this ?

Gabriela Campana (Cloud Posse) avatar
Gabriela Campana (Cloud Posse)

@Jeremy White (Cloud Posse)

Michael Galey avatar
Michael Galey

you likely have session stickiness on on the load balancer, which means each unique session goes to the same instance, to allow for things like safe deploys (once you hit app version 2.0, you no longer hit 1.0). Your load tester is 1 session, so it always hits 1 server. You could temporarily turn off session stickiness during the load test, or else you might have to lookup how it determines that stickiness, and randomize that on the load tester side. AWS Load balancer sets a cookie for that stickiness, so you’d need to clear cookies. Cookie name is AWSALB at least on mine

Emmanuel O avatar
Emmanuel O

Thanks @Michael Galey Currently stickiness if turned off. The problem is that one ecs task takes 87% cpu while the remaining four tasks have 0% utilization. So this has an impact on the scalability of the system. Do you know how I can resolve this ?

Jeremy White (Cloud Posse) avatar
Jeremy White (Cloud Posse)

usually I think about python applications as needing something to share requests. There are a few ways to do this, but a common couple to try first are gunicorn and uwsgi . Do you have any application that’s sharing the listener port with your server threads/PIDs?

Jeremy White (Cloud Posse) avatar
Jeremy White (Cloud Posse)
Jeremy White (Cloud Posse) avatar
Jeremy White (Cloud Posse)

if you are using one of those tool already, could you share your config? Doesn’t have to be all the gory details, but at least some notion of how it decides to spawn your application on a request

Michael Galey avatar
Michael Galey

the above would be per server, he’s already at full utilization on one server. His load balancer is not balancing the load, at least not from a single source.

Michael Galey avatar
Michael Galey

if you do 2-3 load tests of smaller size from a few diff ips, does it go to that number of ecs tasks? I’d suggest trying least-request if that’s an option for the load balancer, otherwise maybe just start simple, follow some tutorial for a basic load balancer + hello world, and compare the load balancer config / target group config against yours. I don’t see how it’s the app’s fault here, I think it’s the load balancer config + single origin ip

Jeremy White (Cloud Posse) avatar
Jeremy White (Cloud Posse)

I better understand now. I’m not sure what’s up, but are you using target groups? Do all the tasks show as healthy?

2024-09-03

2024-09-04

2024-09-05

Veerapandian M avatar
Veerapandian M

Hi, Team. I am looking for help with Azure DevOps repository + AWS Amplify deployment.

bradym avatar

You’re more likely to get help if you ask questions.

Zing avatar

https://github.com/aws/containers-roadmap/issues/474 hey there, how are you all working around aws’ silly limitation on EKS access entries not supporting wildcards? it’s a nightmare for permission set arns, since they have that random string at the end of the permission set role

#474 [EKS] [request]: EKS authentication rolearn wildcard support aka improved support for AWS Identity Center SSO

Tell us about your request
Support basic glob wildcard rolearn matching for aws-auth configmap that controls iam role eks auth.

Which service(s) is this request for?
EKS

Tell us about the problem you’re trying to solve. What are you trying to do, and why is it hard?
Trying to avoid hardcoding lots of IAM role arns into the aws-auth configmap. It would be useful if basic glob wildcard matching worked in the rolearn field of each role mapping:

apiVersion: v1
kind: ConfigMap
metadata:
  name: aws-auth
  namespace: kube-system
data:
  mapRoles: |
    - groups: [AcmeCorp]
      rolearn: arn:aws:iam::111122223333:role/teams/*
      username: AcmeCorp

Are you currently working around this issue?
Individually specifying each rolearn and updating the configmap everytime these roles change:

apiVersion: v1
kind: ConfigMap
metadata:
  name: aws-auth
  namespace: kube-system
data:
  mapRoles: |
    - groups: [AcmeCorp]
      rolearn: arn:aws:iam::111122223333:role/teams/SomeTeam
      username: SomeTeam
    - groups: [AcmeCorp]
      rolearn: arn:aws:iam::111122223333:role/teams/AnotherTeam
      username: AnotherTeam

Additional context
I tried using a * on a working rolearn field and the role became unable to authenticate with the api server. EKS version (Im not sure what component handles this auth delegation, so I dont know of another relevant version to check for that):

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.1", GitCommit:"4485c6f18cee9a5d3c3b4e523bd27972b1b53892", GitTreeState:"clean", BuildDate:"2019-07-18T14:25:20Z", GoVersion:"go1.12.7", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"13+", GitVersion:"v1.13.10-eks-5ac0f1", GitCommit:"5ac0f1d9ab2c254ea2b0ce3534fd72932094c6e1", GitTreeState:"clean", BuildDate:"2019-08-20T22:39:46Z", GoVersion:"go1.11.13", Compiler:"gc", Platform:"linux/amd64"}

RB avatar

Codify each arn in aws auth config

#474 [EKS] [request]: EKS authentication rolearn wildcard support aka improved support for AWS Identity Center SSO

Tell us about your request
Support basic glob wildcard rolearn matching for aws-auth configmap that controls iam role eks auth.

Which service(s) is this request for?
EKS

Tell us about the problem you’re trying to solve. What are you trying to do, and why is it hard?
Trying to avoid hardcoding lots of IAM role arns into the aws-auth configmap. It would be useful if basic glob wildcard matching worked in the rolearn field of each role mapping:

apiVersion: v1
kind: ConfigMap
metadata:
  name: aws-auth
  namespace: kube-system
data:
  mapRoles: |
    - groups: [AcmeCorp]
      rolearn: arn:aws:iam::111122223333:role/teams/*
      username: AcmeCorp

Are you currently working around this issue?
Individually specifying each rolearn and updating the configmap everytime these roles change:

apiVersion: v1
kind: ConfigMap
metadata:
  name: aws-auth
  namespace: kube-system
data:
  mapRoles: |
    - groups: [AcmeCorp]
      rolearn: arn:aws:iam::111122223333:role/teams/SomeTeam
      username: SomeTeam
    - groups: [AcmeCorp]
      rolearn: arn:aws:iam::111122223333:role/teams/AnotherTeam
      username: AnotherTeam

Additional context
I tried using a * on a working rolearn field and the role became unable to authenticate with the api server. EKS version (Im not sure what component handles this auth delegation, so I dont know of another relevant version to check for that):

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.1", GitCommit:"4485c6f18cee9a5d3c3b4e523bd27972b1b53892", GitTreeState:"clean", BuildDate:"2019-07-18T14:25:20Z", GoVersion:"go1.12.7", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"13+", GitVersion:"v1.13.10-eks-5ac0f1", GitCommit:"5ac0f1d9ab2c254ea2b0ce3534fd72932094c6e1", GitTreeState:"clean", BuildDate:"2019-08-20T22:39:46Z", GoVersion:"go1.11.13", Compiler:"gc", Platform:"linux/amd64"}

RB avatar

Now days the aws auth config file is deprecated

RB avatar

You can’t use wildcards/globs in aws auth config or in eks access entries

RB avatar

One way to do it, if youre using terraform, whether with aws auth config or access entries, you can use the data source aws iam roles, specify a wildcard to retrieve all the arns, and then populate the arns in your config map or access entries

RB avatar

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_access_entry

resource "aws_eks_access_entry" "default" {
  for_each = data.aws_iam_roles.default

  cluster_name      = aws_eks_cluster.default.name
  principal_arn     = each.value.arn
  kubernetes_groups = ["group-1", "group-2"]
  type              = "STANDARD"
}
Zing avatar

yeah, i saw that workaround in the thread

Zing avatar

but its so hacky

Zing avatar

i also can see it breaking since we use terragrunt, and it’s hard to pass in data calls into module inputs

Zing avatar

so we’d have to just rely on “in-module” access entries, and ignore the terragrunt layer, i think (maybe not - haven’t thought abt it enough)

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Yes, we’ve run into this as well. It’s one of the reasons we also implement the aws-teams and aws-team-roles architecture in our reference architecture and allow permission sets to assume them. This allows us to have consistent roles for both programmatic/machine access (e.g. GitHub OIDC) as well as for developers.

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

We talk more about our approach here https://docs.cloudposse.com/layers/identity/

Identity and Authentication | The Cloud Posse Reference Architecture

Setup fine-grained access control for an entire organization

Zing avatar

thanks! i’ve been considering going with this approach, but i’m hesitant because of the extra assume role hop (for human users)

Zing avatar

especially non-technical users

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Yes, the extra assume role hop is really for technical users

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

But sounds like you’re using EKS. You have technical users.

Zing avatar

yeah, but we have a fair amount of non technical users (clickops in the console), and i’m not sure what we’d do for them. i think the extra assume role in the console would make dem go nuts but i guess a hybrid approach could work too…

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

@Jeremy G (Cloud Posse) might have some updated ideas on this we haven’t yet tried. He’s OoO though.

2024-09-06

2024-09-07

Mark avatar

Hey everyone, Recently we did a change on our ECS infrastructure. We’ve transitioned to using AWS service discovery and have configured our containers to use HTTPS on their hostnames. After resolving various issues with appsettings and Dockerfiles, the HTTPS port is now open. Previously, we used an ALB for each service in the ECS cluster. With the move to HTTPS and service discovery, we need to set HTTPS as the port for service health checks. The challenge we’re facing is that target groups don’t allow us to define a hostname for service discovery. You might wonder why we switched to HTTPS. The decision was driven by difficulties we encountered with service discovery, which we found were best addressed by using HTTPS. I’ve attached the task definition file for one of the services and the appsettings file. These should help illustrate the issue with the target group’s inability to accept a hostname. Just a note: I’m fairly new to DevOps—only been in this field for two months—and I’m really enjoying the learning process!

andrey.a.devyatkin avatar
andrey.a.devyatkin

here is the text version with links https://fivexl.io/blog/ecs-service-connect-encryption/

Keeping your data secure in transit with ECS Service Connect

Deep-dive into AWS ECS Service Connect. How startup can enable encryption in transit with ECS Service Connect and ECS Fargate deployment

Fizz avatar

Why don’t you let the ECS service manage registration with the target group for you? It’s allowed to use both service discovery AND allow the ECS service to register task IPs with the target group

Mark avatar

@andrey.a.devyatkin Thank you so much for the video! @Fizz Yup, this is what i chose to go with, during the creation process when defining the ECS service, i choose the load balancer and then i was prompted to create the Target Group & add it to the listener. All the ports of which i used use HTTPS now and it’s working perfectly, am just adding a route 53 entry and then we will go public!

Rishav avatar

This is super neat to see, and do share your experience during and after the process! I’m keen to implement ECS Service Connect within Fargate target groups using Terraform provisioning, as soon as I’m able wrap my mind around it.

andrey.a.devyatkin avatar
andrey.a.devyatkin

@Rishav checkout blog post and video above - they go into details of ECS Service Connect implementation for ECS/Fargate

Veerapandian M avatar
Veerapandian M

I am a team looking for help with the yml pipeline for Azure DevOps to Azure static Apps service in the nextjs application.

2024-09-08

2024-09-09

Dexter Cariño avatar
Dexter Cariño

Hello, how to deploy docker compose on aws fargate? I searched some but its outdated/retired.

Darren Cunningham avatar
Darren Cunningham

I think you’re looking for https://github.com/aws/amazon-ecs-cli

Dexter Cariño avatar
Dexter Cariño

will check on this.

Dexter Cariño avatar
Dexter Cariño

thank you

1
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Yea, unfortunately they deprecated docker compose deployments to ECS in the docker-compose CLI

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

We were really bummed about that

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

wow, @Darren Cunningham i didn’t know about this new ECS cli

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

And this amazon-ecs-cli is different from the other ECS cli by AWS https://aws.github.io/copilot-cli/

AWS Copilot CLI

Develop, Release and Operate Container Apps on AWS.

2024-09-10

2024-09-11

Zing avatar

https://github.com/aws/containers-roadmap/issues/2411

Can we get some traction on this

Support for custom eks access entry policies

2024-09-12

    keyboard_arrow_up