Skip to content

Commit

Permalink
[AWS] Fix opening ports (#3719)
Browse files Browse the repository at this point in the history
* Fix opening ports for AWS

* fix comment

* format
  • Loading branch information
Michaelvll authored Jul 3, 2024
1 parent ad5966d commit f0f4de8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sky/provision/aws/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,15 @@ def open_ports(
range(existing_rule['FromPort'], existing_rule['ToPort'] + 1))
elif existing_rule['IpProtocol'] == '-1':
# For AWS, IpProtocol = -1 means all traffic
existing_ports.add(-1)
for group_pairs in existing_rule['UserIdGroupPairs']:
if group_pairs['GroupId'] != sg.id:
# We skip the port opening when the rule allows access from
# other security groups, as that is likely added by a user
# manually and satisfy their requirement.
# The security group created by SkyPilot allows all traffic
# from the same security group, which should not be skipped.
existing_ports.add(-1)
break
break

ports_to_open = []
Expand Down

0 comments on commit f0f4de8

Please sign in to comment.