{"id":28377512,"url":"https://github.com/ydataai/aws-asg-tags-lambda","last_synced_at":"2025-06-26T21:32:17.143Z","repository":{"id":37621397,"uuid":"503836411","full_name":"ydataai/aws-asg-tags-lambda","owner":"ydataai","description":"A lambda that extracts the auto scaling groups from the k8s node pools provided by the user and adds the specified tags to those nodes","archived":false,"fork":false,"pushed_at":"2025-06-13T23:56:06.000Z","size":123,"stargazers_count":5,"open_issues_count":10,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-06-14T00:28:38.879Z","etag":null,"topics":["autoscaling-groups","aws","aws-lambda","cloudformation","k8s","kubernetes","lambda","nodepool","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ydataai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-06-15T16:08:41.000Z","updated_at":"2024-07-26T10:22:56.000Z","dependencies_parsed_at":"2023-12-22T04:32:24.896Z","dependency_job_id":"ea7da0b1-d109-4882-88cb-4b6ed504fed1","html_url":"https://github.com/ydataai/aws-asg-tags-lambda","commit_stats":null,"previous_names":[],"tags_count":80,"template":false,"template_full_name":"ydataai/opensource-template","purl":"pkg:github/ydataai/aws-asg-tags-lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydataai%2Faws-asg-tags-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydataai%2Faws-asg-tags-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydataai%2Faws-asg-tags-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydataai%2Faws-asg-tags-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ydataai","download_url":"https://codeload.github.com/ydataai/aws-asg-tags-lambda/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydataai%2Faws-asg-tags-lambda/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262145181,"owners_count":23265885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autoscaling-groups","aws","aws-lambda","cloudformation","k8s","kubernetes","lambda","nodepool","swift"],"created_at":"2025-05-30T01:05:41.508Z","updated_at":"2025-06-26T21:32:17.130Z","avatar_url":"https://github.com/ydataai.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Released](https://img.shields.io/github/v/release/ydataai/aws-asg-tags-lambda?display_name=tag\u0026label=release\u0026logo=github\u0026sort=semver\u0026style=flat-square)](https://github.com/ydataai/aws-asg-tags-lambda/actions/workflows/released.yml)\n[![PreReleased](https://img.shields.io/github/v/release/ydataai/aws-asg-tags-lambda?display_name=tag\u0026include_prereleases\u0026label=prerelease\u0026logo=github\u0026sort=semver\u0026style=flat-square)](https://github.com/ydataai/aws-asg-tags-lambda/actions/workflows/prereleased.yml)\n[![CI Status](https://img.shields.io/github/workflow/status/ydataai/aws-asg-tags-lambda/Merge%20Main?label=ci\u0026logo=github\u0026style=flat-square)](https://github.com/ydataai/aws-asg-tags-lambda/actions/workflows/merge-main.yml)\n[![license](https://img.shields.io/github/license/ydataai/aws-asg-tags-lambda?label=license\u0026style=flat-square)](https://github.com/ydataai/aws-asg-tags-lambda/blob/main/LICENSE)\n[![Swift 5.6](https://img.shields.io/badge/Swift-5.6-orange.svg?style=flat-square\u0026logo=swift)](https://developer.apple.com/swift/)\n\n# AWS Auto Scaling Groups Tag lambda\n\nA lambda that add tags to the auto scaling groups of each k8s node.\n\nYou have to specify the cluster, the pools and the tags for each pool, or specify them in the common tags if you want the same tag for each node you want to process.\n\n## How to use\n\n### Push to AWS ECR\n\nOur pipelines publish every new release to the docker hub, but in order to call it from a lambda, you have to push it to your AWS account private ECR.\n\nExample  (take into account that you can tag it with the name you want):\n\n```bash\ndocker pull ydata/aws-asg-tags-lambda:1.0.0\ndocker tag ydata/aws-asg-tags-lambda:1.0.0 \u003cyour private ECR\u003e/aws-asg-tags-lambda:1.0.0\ndocker push \u003cyour private ECR\u003e/aws-asg-tags-lambda:1.0.0\n```\n\n### CloudFormation\n\nThe execution role is necessary to connect to the EKS and EC2 for the auto scaling groups\n\n```yaml\nASGTagLambdaExecutionRole:\n  Type: AWS::IAM::Role\n  Properties:\n    RoleName: !Join\n      - '-'\n        - 'role'\n    AssumeRolePolicyDocument:\n      Version: '2012-10-17'\n      Statement:\n      - Effect: Allow\n        Principal:\n          Service:\n          - lambda.amazonaws.com\n        Action:\n        - sts:AssumeRole\n    ManagedPolicyArns:\n    - arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole\n    Policies:\n    - PolicyName: !Join\n        - '-'\n          - 'lambda-asg-tag'\n      PolicyDocument:\n        Version: '2012-10-17'\n        Statement:\n        - Effect: Allow\n          Action:\n          - eks:*\n          - autoscaling:CreateOrUpdateTags\n          Resource: '*'\n```\n\nThe declaration of the lambda function, which will be used by the invoke\n\n```yaml\nASGTagLambdaFunction:\n  Type: AWS::Lambda::Function\n  Properties:\n    Role: !GetAtt ASGTagLambdaExecutionRole.Arn\n    PackageType: Image\n    Code:\n      ImageUri: !Ref EcrImageUri\n    Architectures:\n    - x86_64\n    MemorySize: 1024\n    Timeout: 300\n```\n\nThe lambda invokation\n\n```yaml\nASGTagLambdaInvoke:\n  Type: AWS::CloudFormation::CustomResource\n  DependsOn: ASGTagLambdaFunction\n  Version: \"1.0\"\n  Properties:\n    ServiceToken: !GetAtt ASGTagLambdaFunction.Arn\n    StackID: !Ref AWS::StackId\n    AccountID: !Ref AWS::AccountId\n    Region: !Ref AWS::Region\n    ClusterName: \"the EKS cluster name\" #!Ref EKSCluster\n    CommonTags:\n    - Name: \"ENVIRONMENT\"\n      Value: \"dev\"\n      PropagateAtLaunch: true\n    NodePools:\n    - Name: \"system-nodepool\" #!GetAtt YourNodeGroup.NodegroupName\n      Tags:\n      - Name: 'k8s.io/cluster-autoscaler/node-template/taint/TAINT'\n        Value: 'TAINT_VALUE:TAINT_EFFECT'\n        PropagateAtLaunch: true\n      - Name: 'k8s.io/cluster-autoscaler/node-template/label/LABEL'\n        Value: 'LABEL_VALUE'\n        PropagateAtLaunch: true\n    - Name: \"another-pool\"\n\n```\n\nBoth `CommonTags` and `Tags` of each NodePool are optional, but if you don't specify `CommonTags` neither `Tags` for each NodePool, it will not do anything.\n\nCheck the following examples for other valid combinations\n\nAn example with only `CommonTags`\n\n```yaml\nEKSASGTagLambdaInvoke:\n  Type: AWS::CloudFormation::CustomResource\n  DependsOn: EKSASGTagLambdaFunction\n  Version: \"1.0\"\n  Properties:\n    ServiceToken: !GetAtt EKSASGTagLambdaFunction.Arn\n    StackID: !Ref AWS::StackId\n    AccountID: !Ref AWS::AccountId\n    Region: !Ref AWS::Region\n    ClusterName: \"the EKS cluster name\"\n    CommonTags:\n    - Name: \"ENVIRONMENT\"\n      Value: \"prod\"\n      PropagateAtLaunch: true\n    NodePools:\n    - Name: \"system-nodepool\"\n    - Name: \"applications-nodepool\"\n```\n\nAn example with only `Tags` for the NodePool\n\n```yaml\nEKSASGTagLambdaInvoke:\n  Type: AWS::CloudFormation::CustomResource\n  DependsOn: EKSASGTagLambdaFunction\n  Version: \"1.0\"\n  Properties:\n    ServiceToken: !GetAtt EKSASGTagLambdaFunction.Arn\n    StackID: !Ref AWS::StackId\n    AccountID: !Ref AWS::AccountId\n    Region: !Ref AWS::Region\n    ClusterName: \"the EKS cluster name\"\n    NodePools:\n    - Name: \"system-nodepool\"\n      Tags:\n      - Name: 'k8s.io/cluster-autoscaler/node-template/taint/TAINT'\n        Value: 'TAINT_VALUE:NoSchedule'\n        PropagateAtLaunch: true\n      - Name: 'k8s.io/cluster-autoscaler/node-template/label/LABEL'\n        Value: 'LABEL_VALUE'\n        PropagateAtLaunch: true\n    - Name: \"application-nodepool\"\n      Tags:\n      - Name: 'k8s.io/cluster-autoscaler/node-template/taint/TAINT'\n        Value: 'TAINT_VALUE:NoSchedule'\n        PropagateAtLaunch: true\n      - Name: 'k8s.io/cluster-autoscaler/node-template/label/LABEL'\n        Value: 'LABEL_VALUE'\n        PropagateAtLaunch: true\n```\n\n## TODO\n- [ ] Add generic context\n- [ ] Tests\n- [x] Better Documentation\n- [ ] Support other methods of invocation\n\n\n## About 👯‍♂️\n\nWith ❤️ from [YData](https://ydata.ai) [Development team](mailto://developers@ydata.ai)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fydataai%2Faws-asg-tags-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fydataai%2Faws-asg-tags-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fydataai%2Faws-asg-tags-lambda/lists"}