Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimize aws permissions required for ecs/fargate cluster #385

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jgdwyer
Copy link

@jgdwyer jgdwyer commented Oct 20, 2022

Intended to address #381

Overview

The goal is to reduce the number of AWS actions/permissions required to run the ECSCluster or FargateCluster. While one can pass skip_cleanup=True to avoid needing many permissions, sometimes one may want cleanup to happen on relevant resources. For example, if one always passes specific iam task roles when launching the cluster, there's no need for the cluster to try to clean up stale iam task roles. By only cleaning up resources that the cluster creates on its own, we can reduce the minimal permissions set.

Changes

  • Add conditional statements to only attempt to clean resources if resource arn's have not been provided for them
  • Move the _cleanup_stale_resources to be a class method rather than a standalone function
  • Break up _cleanup_stale_resources into helper functions for readability purposes

Testing

I've not attempted to test this at all yet, so leaving this as a draft PR for now. But if you all are on board with this kind of approach, I will do some manual testing on my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant