That's right. You can use the TemplateOptions.nodeNames method to assign names to the created nodes. If you are creating N nodes in one single call you can provide the list of names to assign.
I. On Dec 15, 2016 6:14 AM, "Poornima BS" <poornimabs.g...@gmail.com> wrote: > Hi, > > Thanks for clarifying my doubts. > > Let me summarize, > > jclouds tries to identify groupName from keypair or securitygroup. > > Right now this the limitation. > > While creating nodes we have to use groupName > > Is there any way we can create nodes without using groupName. > > In compute API i don't find any methods which does without using groupName. > > Please correct me if i am wrong. > > > Thanks & Regards, > Poornima.BS > > > On Tue, Dec 13, 2016 at 3:12 AM, Ignasi Barrera <n...@apache.org> wrote: > > > BTW, where I said "sensible" I meant "sentitive" :) > > > > > > > > > > On 12 December 2016 at 16:40, Ignasi Barrera <ignasi.barr...@gmail.com> > > wrote: > > > Hi! > > > > > > I'll try to answer inline: > > > > > >>> 1. So is it possible to use an existing key pair created from amazon > > >>> console and consume from jclouds while launching an instance. > > >>> Say keyPair(poornima). > > >>> As per my knowledge it can create an instance without error but while > > >>> executing script using runScriptOnNodesMatching() gives 'no nodes > > matched > > >>> filter' with groupName poornima. > > > > > > That's right > > > > > >>> 2. In above case we should create key pair from jclouds and consume > > from > > >>> jclouds. Other option would be create a keypair with prefix > > "jclouds#jcloud" > > > > > > You can create the keypairs yourself or let jclodus create them for > > > you. You just need to take the mentioned limitation into account, so > > > the group can be resolved. > > > Take also into account that the group name is also resolved from the > > > security groups, so if you configure access to your instance using the > > > TemplateOptions#inboundPorts method, or you create the security groups > > > following the jclouds naming convention, jclodus should eb able to > > > resolve the group from the security groups the instance is assigned > > > to, and you should be able to use whatever name you prefer for the key > > > pair. > > > But again, this is very sensible and you're relying on this limitation > > > of jclouds. > > > > > >>> 3. if keyPair Name is 'jclouds#Testkeypair' groupname should be > > >>> TestKeyPair while creating an instance? > > > > > > Yes > > > > > >>> 4. In case of tags can u please elaborate on tags limitation > > > > > > Here you have the tag restrictions: > > > http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_ > > Tags.html#tag-restrictions > > > > > > Adding to above points if i want to create keypair using jcloud is it > > >> necessary for me to use > > >> > > >> "jclouds#" prefix while calling createKeyPairInRegion(region,name) > > >> > > >> If i use without prefix i will get below, > > > > > > When you access directly the jclouds EC2/AWSEC2 APIs you get a client > > > to their API without any addition. Any call you perform using those > > > APIs directly will be translated into direct calls to the AWS API. So > > > yes, you need to put the prefix if you're doing that. Take into > > > account that the value of the prefix can be customized by setting the > > > ComputeServiceProperties.RESOURCENAME_PREFIX property, so you'd better > > > read that value to make sure you are always setting the right value > > > for the prefix. > > > > > > > > > HTH! > > > > > > I. > > > > > > > > > [1] https://jclouds.apache.org/reference/javadoc/2.0.x/org/ > > jclouds/compute/config/ComputeServiceProperties.html#RESOURCENAME_PREFIX > > > > > > > > > > > > On 12 December 2016 at 13:05, Poornima BS <poornimabs.g...@gmail.com> > > wrote: > > >> Also, > > >> > > >> Adding to above points if i want to create keypair using jcloud is it > > >> necessary for me to use > > >> > > >> "jclouds#" prefix while calling createKeyPairInRegion(region,name) > > >> > > >> If i use without prefix i will get below, > > >> > > >> java.util.NoSuchElementException: no nodes matched filter: > > >> inGroup(production) > > >> at > > >> org.jclouds.compute.internal.BaseComputeService. > > nodesMatchingFilterAndNotTerminatedExceptionIfNotFound( > > BaseComputeService.java:325) > > >> at > > >> org.jclouds.compute.internal.BaseComputeService. > > runScriptOnNodesMatching(BaseComputeService.java:579) > > >> at org.jclouds.examples.compute.basics.MainApp.main(MainApp.java:187) > > >> error: no nodes matched filter: inGroup(production) > > >> > > >> Any suggestion would be helpful > > >> > > >> Thanks & Regards, > > >> Poornima.BS > > >> > > >> On Mon, Dec 12, 2016 at 4:29 PM, Poornima BS < > poornimabs.g...@gmail.com > > > > > >> wrote: > > >> > > >>> Hi, > > >>> > > >>> Thanks for your reply. > > >>> > > >>> I have some doubts, > > >>> > > >>> 1. So is it possible to use an existing key pair created from amazon > > >>> console and consume from jclouds while launching an instance. > > >>> Say keyPair(poornima). > > >>> As per my knowledge it can create an instance without error but while > > >>> executing script using runScriptOnNodesMatching() gives 'no nodes > > matched > > >>> filter' with groupName poornima. > > >>> > > >>> 2. In above case we should create key pair from jclouds and consume > > from > > >>> jclouds. Other option would be create a keypair with prefix > > "jclouds#jcloud" > > >>> > > >>> 3. if keyPair Name is 'jclouds#Testkeypair' groupname should be > > >>> TestKeyPair while creating an instance? Is there any workaround for > > same > > >>> > > >>> 4. In case of tags can u please elaborate on tags limitation > > >>> > > >>> Does it mean each instance in amazon can have 50 tags or overall > > account > > >>> can have 50 tags. > > >>> I want this to be clarified because i am planning to use > > >>> userMetaData("Name", "Test") option while launching instance so that > > we can > > >>> identify machine. > > >>> > > >>> Please correct me if i am wrong in all above points. > > >>> > > >>> > > >>> Thanks & Regards, > > >>> Poornima.BS > > >>> > > >>> On Fri, Dec 9, 2016 at 10:49 PM, Ignasi Barrera <n...@apache.org> > > wrote: > > >>> > > >>>> Hi Poornima, > > >>>> > > >>>> This is a limitation specific to the aws-ec2 provider > implementation. > > >>>> jclouds uses a naming convention and creates the key pairs and > > >>>> security groups with a prefix (usually 'jclouds') and a suffix that > is > > >>>> the "group". When getting the list of nodes, it parses the keys and > > >>>> groups an instance is assigned to, and tries to extract the group > from > > >>>> there. > > >>>> > > >>>> We could definitely do better by storing the group in an instance > tag, > > >>>> but instance tags are limited to 50, and tags and user metadata key > > >>>> value pairs are stored there. It is possible that we run out of tags > > >>>> if we follow that approach, although I believe that won't be the > > >>>> common pattern and it is a much consistent approach. (Mind opening a > > >>>> JIRA [1] issue to track this?). > > >>>> > > >>>> In your case, since you are assigning the key pair "jclouds#jcloud", > > >>>> jclouds believes it belongs to the "jcloud" group. That's why the > > >>>> runScript method does not find groups. If you enable the > > >>>> "jclouds.compute" logger at debug level [2] you should see relevant > > >>>> logs. > > >>>> > > >>>> > > >>>> HTH! > > >>>> > > >>>> I. > > >>>> > > >>>> [1] https://issues.apache.org/jira/browse/JCLOUDS > > >>>> [2] https://jclouds.apache.org/reference/logging/ > > >>>> > > >>>> On 9 December 2016 at 05:56, Poornima BS <poornimabs.g...@gmail.com > > > > >>>> wrote: > > >>>> > Hi, > > >>>> > > > >>>> > Please let me know how jcloud works wrt groupName and keypair > > >>>> > > > >>>> > 1. Suppose my groupName and key pair is as below > > >>>> > > > >>>> > String groupName = "jcloud"; > > >>>> > > > >>>> > keyPair("jclouds#jcloud") - keypairname created in AWS > > >>>> > > > >>>> > Then execution of script works fine i.e runScriptOnNodesMatching > > >>>> > > > >>>> > 2. if i give a different groupName say, > > >>>> > > > >>>> > String groupName = "jcloudTest"; > > >>>> > > > >>>> > and use an existing keypair say keyPair("jclouds#jcloud") > > >>>> > > > >>>> > Then runScriptOnNodesMatching gives error: no nodes matched > filter: > > >>>> > inGroup(jcloudTest) > > >>>> > > > >>>> > Please let me know how groupName and keypair work together > > >>>> > > > >>>> > 3. Also keypair is expected to be appended with "jclouds#" i.e. > > jclouds > > >>>> > finds for keypair with jclouds# prefix > > >>>> > > > >>>> > The groupName and keypair name should be same, then how can i > create > > >>>> > machines in multiple groups. > > >>>> > > > >>>> > Can u please let me know what is going wrong with using existing > > >>>> keypair. > > >>>> > > > >>>> > ```` > > >>>> > Template template = templateBuilder.build(); > > >>>> > > > >>>> > template.getOptions().as(AWSEC2TemplateOptions.class).subnet > > >>>> Id("subnet-a1e1d08b"). > > >>>> > > > >>>> > keyPair("jclouds#jcloud").overrideLoginPrivateKey(login. > credential) > > >>>> > ```` > > >>>> > By using above template options i dont get issues while launching > > >>>> instance, > > >>>> > but while executing service i get below error, > > >>>> > > > >>>> > ```` > > >>>> > java.util.NoSuchElementException: no nodes matched filter: > > >>>> inGroup(jcloud1) > > >>>> > at org.jclouds.compute.internal.BaseComputeService. > > >>>> > nodesMatchingFilterAndNotTerminatedExceptionIfNotFound( > > >>>> > BaseComputeService.java:325) > > >>>> > at org.jclouds.compute.internal.BaseComputeService.runScriptOnN > > >>>> odesMatching( > > >>>> > BaseComputeService.java:579) > > >>>> > at org.jclouds.examples.compute.basics.MainApp.main(MainApp. > > java:187) > > >>>> > error: no nodes matched filter: inGroup(jcloud1) > > >>>> > ```` > > >>>> > > > >>>> > > > >>>> > Thanks & Regards, > > >>>> > Poornima.BS > > >>>> > > >>> > > >>> > > >