| 1 | /** |
| 2 | * |
| 3 | * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com> |
| 4 | * |
| 5 | * ==================================================================== |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | * ==================================================================== |
| 18 | */ |
| 19 | package org.jclouds.aws.ec2; |
| 20 | |
| 21 | import static org.jclouds.Constants.PROPERTY_ENDPOINT; |
| 22 | import static org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_CC_AMIs; |
| 23 | import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_TIMEOUT_NODE_SUSPENDED; |
| 24 | import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS; |
| 25 | |
| 26 | import java.util.Properties; |
| 27 | |
| 28 | import org.jclouds.aws.domain.Region; |
| 29 | |
| 30 | /** |
| 31 | * Builds properties used in EC2 Clients |
| 32 | * |
| 33 | * @author Adrian Cole |
| 34 | */ |
| 35 | public class AWSEC2PropertiesBuilder extends org.jclouds.ec2.EC2PropertiesBuilder { |
| 36 | @Override |
| 37 | protected Properties defaultProperties() { |
| 38 | Properties properties = super.defaultProperties(); |
| 39 | // sometimes, like in ec2, stop takes a very long time, perhaps |
| 40 | // due to volume management. one example spent 2 minutes moving |
| 41 | // from stopping->stopped state on an ec2 micro |
| 42 | properties.setProperty(PROPERTY_TIMEOUT_NODE_SUSPENDED, 120 * 1000 + ""); |
| 43 | // auth fail sometimes happens in EC2, as the rc.local script that injects the |
| 44 | // authorized key executes after ssh has started |
| 45 | properties.setProperty("jclouds.ssh.max_retries", "7"); |
| 46 | properties.setProperty("jclouds.ssh.retryable_messages", |
| 47 | "Auth fail,failed to send channel request,channel is not opened,invalid data,End of IO Stream Read,Connection reset,socket is not established,connection is closed by foreign host,socket is not established"); |
| 48 | properties.setProperty(PROPERTY_ENDPOINT, "https://ec2.us-east-1.amazonaws.com"); |
| 49 | properties.putAll(Region.regionProperties()); |
| 50 | // amazon, alestic, canonical, and rightscale |
| 51 | properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "137112412989,063491364108,099720109477,411009282317"); |
| 52 | // amis that work with the cluster instances |
| 53 | properties.setProperty(PROPERTY_EC2_CC_AMIs, "us-east-1/ami-321eed5b,us-east-1/ami-7ea24a17"); |
| 54 | return properties; |
| 55 | } |
| 56 | |
| 57 | public AWSEC2PropertiesBuilder() { |
| 58 | super(); |
| 59 | } |
| 60 | |
| 61 | public AWSEC2PropertiesBuilder(Properties properties) { |
| 62 | super(properties); |
| 63 | } |
| 64 | |
| 65 | } |