-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[Question]: Adding an existing Security Group to an ALB #1948
Comments
Ah, good point. It's actually not 100% obvious what the "correct" behaviour should be here, and I suspect reasonable people may have different reasonable opinions. Right now, passing a SecurityGroup will prevent a new SecurityGroup from being created, but new rules will still be added to allow traffic back and forth between constructs. This behavior is consistent with, for example, how Roles are passed in. We won't create a Role, but we will add new policy statements to the roles in order to make interactions between resources work. The feature is currently intended more to allow sharing of objects such as SGs and Roles between constructs, rather than a complete abdication of management responsibilities by the CDK. I imagine you're asking this from the perspective of someone who works at a company where the creation of "security-related" resources such as IAM roles and security groups is only allowed by a select group of non-application developers? |
Rico, is this a sub-set of #1546 ? |
@rix0rrr That is correct. We cannot create or update any IAM roles, policies or security groups. |
@Doug-AWS, no, don't worry about it. |
I think the correct solution for this problem is going to be:
|
@rix0rrr Thanks for helping me out with this, but I can't seem to find I can see
EDIT: I think I figured it out on no-op (see #1957), but I still need
|
You are right, the You should be able to implement them yourself though. class ExternallyManagedSomething extends cdk.Construct implements iam.IRole {
public get roleArn(): string {
return 'arn:aws:us-east-1:13245:role/my-role';
}
public addToPolicy(statement: iam.PolicyStatement) {
// do nothing
}
} I've skipped over some details here so this code will not suffice for copy/pasting, but it should give you an idea on how to proceed. |
The unfortunate truth is we don't support your scenario as of today, so you're kind of on your own. |
I'm seeing the same behavior when creating a Fargate service and passing a ref to an existing SG, it seems to create a new one. |
Same issue here. Any updates on this? Importing only creates new SGs and ignores the security group id passed into it |
Similar issue, we have need of restricting a public LB to a security group's rules, but it forces creation of open-to-the-world port 80/443 rules in that group. |
Also interested to hear about this |
Is there any progress on restricting public access on a load balancer with an already created security group? Not sure of a work around for this particular issue. |
|
Im having some what similar behavior
this generates egress rule on load balancer's security group.
So it seems like it took the port and protocol that I used to add Target Group and used it on it's default security group. (since I never imported this security group, I assume it automatically pulled default security group that was assigned to load balancer) In my case, the biggest issue is that it replaces my egress rule that was allowing all traffic, causing other services in the load balancer to fail the healthcheck. The only way I found to avoid this rule is to manually fix cdk.conext.json where it pulls security group info |
If using the |
When I add an existing security group to
elbv2.ApplicationLoadBalancer
CFN still tries to create security group ingress resource. Is this by design? I thought that once you import the SG, ALB would just accept it as is (ISecurityGroup
). Is this not the case or I’m doing something wrong? Do I need to usecfnLoadBalancer
instead? Thanks!The text was updated successfully, but these errors were encountered: