[ https://issues.apache.org/jira/browse/JCLOUDS-1105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ignasi Barrera updated JCLOUDS-1105: ------------------------------------ Affects Version/s: 1.9.2 > JClouds creates default security group in AWS EC2 > ------------------------------------------------- > > Key: JCLOUDS-1105 > URL: https://issues.apache.org/jira/browse/JCLOUDS-1105 > Project: jclouds > Issue Type: Bug > Components: jclouds-compute > Affects Versions: 1.9.2 > Reporter: Andras Nemes > Labels: aws-ec2, ec2 > > I'm creating EC2 machines in AWS using JClouds. The machines are created > without any issues but they are put into a default security group created by > JClouds. A typical default security group by JClouds will have the "jclouds#" > prefix like here: > jclouds#euweawlt-c96-j40788-26 > Since we have predefined security groups I want to use them instead. > According to the JClouds AWS guide > (https://jclouds.apache.org/guides/aws-ec2/) this should be possible through > a simple line of code: > template.getOptions().as(EC2TemplateOptions.class).securityGroups(group1, > group2); > So I've added it to my code as well: > computeTemplate.getOptions().as(EC2TemplateOptions.class).securityGroups(securityGroup); > ...where securityGroup is the name of our predefined security group. > The same documentation page states that this should be enough: > "With respect to the security group, jclouds creates a security group for > you, with rules corresponding to the inboundPorts() option (defaults to open > port 22), unless you use the option EC2TemplateOptions.securityGroups()." > The end result is that the EC2 machine is added to the security group > specified by the above code AND the default "jcloud#..." security group as > well. Hence JClouds does create a default security group after all. > I really want to get rid of that since we already have a security group, it > is not removed when the machine is terminated and there have been exceptions > thrown by the JClouds API due the security group not being available after > creation, whatever that means. > I posted the same question on stack overflow here: > http://stackoverflow.com/questions/36744104/jclouds-creates-default-security-group-in-aws-ec2-how-can-i-block-that > The answer by Ignasi Barrera suggests that a simple change in the source code > should change this behaviour. Here's the link to the code that should be > changed: > https://github.com/jclouds/jclouds/blob/master/apis/ec2/src/main/java/org/jclouds/ec2/compute/strategy/CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.java#L180-L181 -- This message was sent by Atlassian JIRA (v6.3.4#6332)