This repository was archived by the owner on Jul 18, 2025. It is now read-only.
[EC2 driver] Only open SSH, docker and swarm ports on the first security group #3856
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
PR #3111 enabled the EC2 driver to handle setting multiple security groups on EC2 instances. Yet, this also opens SSH, docker and swarm ports for each security group set using
--amazonec2-security-group
flag which (I think) is useless and unexpected. Setting the rule on one security group only would be sufficient, proper and safer.This PR opens the required ports on the first security group provided only. Therefore, this makes the CLI options order-sensitive (I don't know if it is already). Maybe that's not what is expected either.
If this is problematic, another solution I could implement could be to set the main security group using the
--amazonec2-security-group docker-sg
flag and set extra security groups using some kind of--amazonec2-extra-security-group some-extra-sg
flag. This would mean that only one--amazonec2-security-group
flag could be accepted, but multiple--amazonec2-extra-security-group
flags could be provided (with no order consideration).Another (less intrusive) solution that would address my issue as a side-effect would be to add a flag that would make the driver trust the security groups provided and not try to update them. You'd have to pre-configure them using the AWS CLI.
Please, let me know what is acceptable to you, and tell me where and how I can document this if ever it's needed.
Thank you.