com.amazonaws.services.ec2.model.Placement Java Examples
The following examples show how to use
com.amazonaws.services.ec2.model.Placement.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Ec2IaasHandler.java From roboconf-platform with Apache License 2.0 | 5 votes |
/** * Prepares the request. * @param targetProperties the target properties * @param userData the user data to pass * @return a request * @throws UnsupportedEncodingException */ private RunInstancesRequest prepareEC2RequestNode( Map<String,String> targetProperties, String userData ) throws UnsupportedEncodingException { RunInstancesRequest runInstancesRequest = new RunInstancesRequest(); String flavor = targetProperties.get(Ec2Constants.VM_INSTANCE_TYPE); if( Utils.isEmptyOrWhitespaces( flavor )) flavor = "t1.micro"; runInstancesRequest.setInstanceType( flavor ); runInstancesRequest.setImageId( targetProperties.get( Ec2Constants.AMI_VM_NODE )); runInstancesRequest.setMinCount( 1 ); runInstancesRequest.setMaxCount( 1 ); runInstancesRequest.setKeyName( targetProperties.get(Ec2Constants.SSH_KEY_NAME)); String secGroup = targetProperties.get(Ec2Constants.SECURITY_GROUP_NAME); if( Utils.isEmptyOrWhitespaces(secGroup)) secGroup = "default"; runInstancesRequest.setSecurityGroups(Collections.singletonList(secGroup)); String availabilityZone = targetProperties.get(Ec2Constants.AVAILABILITY_ZONE); if(! Utils.isEmptyOrWhitespaces(availabilityZone)) runInstancesRequest.setPlacement(new Placement(availabilityZone)); // The following part enables to transmit data to the VM. // When the VM is up, it will be able to read this data. String encodedUserData = new String( Base64.encodeBase64( userData.getBytes( StandardCharsets.UTF_8 )), "UTF-8" ); runInstancesRequest.setUserData( encodedUserData ); return runInstancesRequest; }
Example #2
Source File: InstanceConverter.java From primecloud-controller with GNU General Public License v2.0 | 4 votes |
@Override protected Instance convertObject(com.xerox.amazonws.ec2.ReservationDescription.Instance from) { Instance to = new Instance(); to.setInstanceId(from.getInstanceId()); to.setImageId(from.getImageId()); InstanceState state = new InstanceState(); state.setCode(from.getStateCode()); state.setName(from.getState()); to.setState(state); to.setPrivateDnsName(from.getPrivateDnsName()); to.setPublicDnsName(from.getDnsName()); to.setStateTransitionReason(from.getReason()); to.setKeyName(from.getKeyName()); to.setAmiLaunchIndex(null); to.setProductCodes(null); to.setInstanceType(from.getInstanceType().name()); to.setLaunchTime(from.getLaunchTime().getTime()); Placement placement = new Placement(); placement.setAvailabilityZone(from.getAvailabilityZone()); placement.setGroupName(null); // 未実装 to.setPlacement(placement); to.setKernelId(from.getKernelId()); to.setRamdiskId(from.getRamdiskId()); to.setPlatform(from.getPlatform()); Monitoring monitoring = new Monitoring(); monitoring.setState(Boolean.toString(from.isMonitoring())); to.setMonitoring(monitoring); // 未実装 to.setSubnetId(null); to.setVpcId(null); to.setPrivateIpAddress(null); to.setPublicIpAddress(null); to.setStateReason(null); //to.setArchitecture(null); to.setRootDeviceName(null); to.setRootDeviceName(null); to.setBlockDeviceMappings(null); //to.setVirtualizationType(null); //to.setInstanceLifecycle(null); to.setSpotInstanceRequestId(null); //to.setLicense(null); to.setClientToken(null); to.setTags(null); return to; }
Example #3
Source File: InstanceImpl.java From aws-sdk-java-resources with Apache License 2.0 | 4 votes |
@Override public Placement getPlacement() { return (Placement) resource.getAttribute("Placement"); }
Example #4
Source File: Instance.java From aws-sdk-java-resources with Apache License 2.0 | 2 votes |
/** * Gets the value of the Placement attribute. If this resource is not yet * loaded, a call to {@code load()} is made to retrieve the value of the * attribute. */ Placement getPlacement();