Hi Mauricio, You should use only the name of the key pair instead of the file name.
Just use "tom-demo" as the key pair. On Thu, Jul 11, 2013 at 1:51 AM, Mauricio Alarcon <mauricio...@gmail.com>wrote: > Hi Nirmal, > > Thank you very much, that way indeed solved the issue with the security > group. I'm still having issues with the keyPair. Now it complains with the > following message > > "Exception in thread "main" java.lang.IllegalArgumentException: no > private key configured for: {region=us-east-1, name=tom-demo.pem}; please > use options.overrideLoginCredentialWith(rsa_private_text) > > at com.google.common.base.Preconditions.checkArgument( > Preconditions.java:119) > at > org.jclouds.ec2.compute.strategy.CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.createNewKeyPairUnlessUserSpecifiedOtherwise( > CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.java:141)" > > > What I'm trying to do is just use my already provided keypair on ec2. > > How can I make it use the keyPair? > > Thanks > > ~M > > > > > On Wed, Jul 10, 2013 at 12:03 AM, Nirmal Fernando <nir...@wso2.com> wrote: > >> Hi, >> >> Please use >> >> template.getOptions() >> .as(AWSEC2TemplateOptions.class) >> .securityGroups(..) >> >> template.getOptions().as(AWSEC2TemplateOptions.class) >> .keyPair(..) >> >> where template is >> >> Template template = templateBuilder.build(); >> >> Hope this helps! >> >> >> On Wed, Jul 10, 2013 at 2:09 AM, Mauricio Alarcon >> <mauricio...@gmail.com>wrote: >> >>> Hello everybody, >>> >>> I'm very new to jclouds, I'm using 1.6.0 I've found couple of rocks on >>> my path trying to use it with ec2 while overriding the security-groups and >>> keypairs. >>> >>> What I'm trying to accomplish is use my already created security-group >>> and keyPair but I haven't been successful. Found this old thread >>> https://groups.google.com/d/msg/jclouds/ZXwxW5qCNYg/z92wLp8sWlQJ that >>> seems to solve it for version 1.5. but no luck with 1.6 >>> >>> here's what I've got on my simple test >>> https://gist.github.com/mauricioalarcon/40bac95f5aa9cd145bfa >>> >>> As it's there it creates a node and executes my script, But If I >>> uncomment line 15 >>> "templateBuilder.options(inboundPorts(22, 80, 2022, 6060));" >>> it starts complaining that it can't authenticate?? >>> >>> "- <<authenticated>> woke to: >>> net.schmizz.sshj.userauth.UserAuthException: publickey auth failed" >>> >>> 1. How is possible that just setting the inbound ports trigger this? >>> 2. What I'm doing wrong? >>> 3. How can I override with my security-group and keyPair? >>> >>> I tried the following >>> >>> "overrideLoginCredentials(loginCredentials).keyPair("tom-key" >>> ).runAsRoot(true).nameTask("install-infrastructure.sh"));" >>> >>> But it complains about authentication again. >>> >>> Thanks in advance >>> >>> Cheers >>> >>> ~M >>> >> >> >> >> -- >> >> Thanks & regards, >> Nirmal >> >> Senior Software Engineer- Platform Technologies Team, WSO2 Inc. >> Mobile: +94715779733 >> Blog: http://nirmalfdo.blogspot.com/ >> >> > -- Thanks & regards, Nirmal Senior Software Engineer- Platform Technologies Team, WSO2 Inc. Mobile: +94715779733 Blog: http://nirmalfdo.blogspot.com/