com.amazonaws.services.autoscaling.model.BlockDeviceMapping Java Examples
The following examples show how to use
com.amazonaws.services.autoscaling.model.BlockDeviceMapping.
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: GobblinAWSClusterLauncher.java From incubator-gobblin with Apache License 2.0 | 4 votes |
private String launchClusterMaster(String uuid, String keyName, String securityGroups, AvailabilityZone availabilityZone) { // Get cloud-init script to launch cluster master final String userData = CloudInitScriptBuilder.buildClusterMasterCommand(this.clusterName, this.nfsParentDir, this.sinkLogRootDir, this.awsConfDir, this.appWorkDir, this.masterS3ConfUri, this.masterS3ConfFiles, this.masterS3JarsUri, this.masterS3JarsFiles, this.masterJarsDir, this.masterJvmMemory, this.masterJvmArgs, this.gobblinVersion); // Create launch config for Cluster master this.masterLaunchConfigName = MASTER_LAUNCH_CONFIG_NAME_PREFIX + uuid; this.awsSdkClient.createLaunchConfig(this.masterLaunchConfigName, this.masterAmiId, this.masterInstanceType, keyName, securityGroups, Optional.<String>absent(), Optional.<String>absent(), Optional.<BlockDeviceMapping>absent(), Optional.<String>absent(), Optional.<InstanceMonitoring>absent(), userData); // Create ASG for Cluster master // TODO: Make size configurable when we have support multi-master this.masterAutoScalingGroupName = MASTER_ASG_NAME_PREFIX + uuid; final int minNumMasters = 1; final int maxNumMasters = 1; final int desiredNumMasters = 1; final Tag clusterNameTag = new Tag().withKey(CLUSTER_NAME_ASG_TAG).withValue(this.clusterName); final Tag clusterUuidTag = new Tag().withKey(CLUSTER_ID_ASG_TAG).withValue(uuid); final Tag asgTypeTag = new Tag().withKey(ASG_TYPE_ASG_TAG).withValue(ASG_TYPE_MASTER); this.awsSdkClient.createAutoScalingGroup(this.masterAutoScalingGroupName, this.masterLaunchConfigName, minNumMasters, maxNumMasters, desiredNumMasters, Optional.of(availabilityZone.getZoneName()), Optional.<Integer>absent(), Optional.<Integer>absent(), Optional.<String>absent(), Optional.<String>absent(), Optional.<String>absent(), Lists.newArrayList(clusterNameTag, clusterUuidTag, asgTypeTag)); LOGGER.info("Waiting for cluster master to launch"); this.masterPublicIp = getMasterPublicIp(); LOGGER.info("Master public ip: "+ this.masterPublicIp); return uuid; }
Example #2
Source File: GobblinAWSClusterLauncher.java From incubator-gobblin with Apache License 2.0 | 4 votes |
private void launchWorkUnitRunners(String uuid, String keyName, String securityGroups, AvailabilityZone availabilityZone) { // Get cloud-init script to launch cluster worker final String userData = CloudInitScriptBuilder.buildClusterWorkerCommand(this.clusterName, this.nfsParentDir, this.sinkLogRootDir, this.awsConfDir, this.appWorkDir, this.masterPublicIp, this.workerS3ConfUri, this.workerS3ConfFiles, this.workerS3JarsUri, this.workerS3JarsFiles, this.workerJarsDir, this.workerJvmMemory, this.workerJvmArgs, this.gobblinVersion); // Create launch config for Cluster worker this.workerLaunchConfigName = WORKERS_LAUNCH_CONFIG_PREFIX + uuid; this.awsSdkClient.createLaunchConfig(this.workerLaunchConfigName, this.workerAmiId, this.workerInstanceType, keyName, securityGroups, Optional.<String>absent(), Optional.<String>absent(), Optional.<BlockDeviceMapping>absent(), Optional.<String>absent(), Optional.<InstanceMonitoring>absent(), userData); // Create ASG for Cluster workers this.workerAutoScalingGroupName = WORKERS_ASG_NAME_PREFIX + uuid; final Tag clusterNameTag = new Tag().withKey(CLUSTER_NAME_ASG_TAG).withValue(this.clusterName); final Tag clusterUuidTag = new Tag().withKey(CLUSTER_ID_ASG_TAG).withValue(uuid); final Tag asgTypeTag = new Tag().withKey(ASG_TYPE_ASG_TAG).withValue(ASG_TYPE_WORKERS); this.awsSdkClient.createAutoScalingGroup(this.workerAutoScalingGroupName, this.workerLaunchConfigName, this.minWorkers, this.maxWorkers, this.desiredWorkers, Optional.of(availabilityZone.getZoneName()), Optional.<Integer>absent(), Optional.<Integer>absent(), Optional.<String>absent(), Optional.<String>absent(), Optional.<String>absent(), Lists.newArrayList(clusterNameTag, clusterUuidTag, asgTypeTag)); }
Example #3
Source File: AWSSdkClient.java From incubator-gobblin with Apache License 2.0 | 4 votes |
/*** * Create a launch configuration that can be later used to create {@link AmazonAutoScaling} groups * * @param launchConfigName Desired launch config name * @param imageId AMI image id to use * @param instanceType EC2 instance type to use * @param keyName Key name * @param securityGroups Security groups to apply * @param kernelId Optional kernel id * @param ramdiskId Optional ram disk id * @param blockDeviceMapping Optional EBS device mapping * @param iamInstanceProfile Optional IAM instance profile * @param instanceMonitoring Optional instance monitoring * @param userData User data (eg. shell script to execute at instance boot under this launch config) */ public void createLaunchConfig(String launchConfigName, String imageId, String instanceType, String keyName, String securityGroups, Optional<String> kernelId, Optional<String> ramdiskId, Optional<BlockDeviceMapping> blockDeviceMapping, Optional<String> iamInstanceProfile, Optional<InstanceMonitoring> instanceMonitoring, String userData) { final AmazonAutoScaling autoScaling = getAmazonAutoScalingClient(); CreateLaunchConfigurationRequest createLaunchConfigurationRequest = new CreateLaunchConfigurationRequest() .withLaunchConfigurationName(launchConfigName) .withImageId(imageId) .withInstanceType(instanceType) .withSecurityGroups(SPLITTER.splitToList(securityGroups)) .withKeyName(keyName) .withUserData(userData); if (kernelId.isPresent()) { createLaunchConfigurationRequest = createLaunchConfigurationRequest .withKernelId(kernelId.get()); } if (ramdiskId.isPresent()) { createLaunchConfigurationRequest = createLaunchConfigurationRequest .withRamdiskId(ramdiskId.get()); } if (blockDeviceMapping.isPresent()) { createLaunchConfigurationRequest = createLaunchConfigurationRequest .withBlockDeviceMappings(blockDeviceMapping.get()); } if (iamInstanceProfile.isPresent()) { createLaunchConfigurationRequest = createLaunchConfigurationRequest .withIamInstanceProfile(iamInstanceProfile.get()); } if (instanceMonitoring.isPresent()) { createLaunchConfigurationRequest = createLaunchConfigurationRequest .withInstanceMonitoring(instanceMonitoring.get()); } autoScaling.createLaunchConfiguration(createLaunchConfigurationRequest); LOGGER.info("Created Launch Configuration: " + launchConfigName); }
Example #4
Source File: AwsLaunchConfiguration.java From sequenceiq-samples with Apache License 2.0 | 4 votes |
public List<BlockDeviceMapping> getBlockDeviceMappings() { return blockDeviceMappings; }
Example #5
Source File: AwsLaunchConfiguration.java From sequenceiq-samples with Apache License 2.0 | 4 votes |
public void setBlockDeviceMappings(List<BlockDeviceMapping> blockDeviceMappings) { this.blockDeviceMappings = blockDeviceMappings; }
Example #6
Source File: LaunchConfigurationMapper.java From cloudbreak with Apache License 2.0 | 4 votes |
public CreateLaunchConfigurationRequest mapExistingLaunchConfigToRequest(LaunchConfiguration launchConfiguration) { if (launchConfiguration == null) { return null; } CreateLaunchConfigurationRequest createLaunchConfigurationRequest = new CreateLaunchConfigurationRequest(); createLaunchConfigurationRequest.setLaunchConfigurationName(emptyToNullStringMapper.map(launchConfiguration.getLaunchConfigurationName())); createLaunchConfigurationRequest.setImageId(emptyToNullStringMapper.map(launchConfiguration.getImageId())); createLaunchConfigurationRequest.setKeyName(emptyToNullStringMapper.map(launchConfiguration.getKeyName())); List<String> list = launchConfiguration.getSecurityGroups(); if (list != null) { createLaunchConfigurationRequest.setSecurityGroups(new ArrayList<String>(list)); } else { createLaunchConfigurationRequest.setSecurityGroups(null); } createLaunchConfigurationRequest.setClassicLinkVPCId(emptyToNullStringMapper.map(launchConfiguration.getClassicLinkVPCId())); List<String> list1 = launchConfiguration.getClassicLinkVPCSecurityGroups(); if (list1 != null) { createLaunchConfigurationRequest.setClassicLinkVPCSecurityGroups(new ArrayList<String>(list1)); } else { createLaunchConfigurationRequest.setClassicLinkVPCSecurityGroups(null); } createLaunchConfigurationRequest.setUserData(emptyToNullStringMapper.map(launchConfiguration.getUserData())); createLaunchConfigurationRequest.setInstanceType(emptyToNullStringMapper.map(launchConfiguration.getInstanceType())); createLaunchConfigurationRequest.setKernelId(emptyToNullStringMapper.map(launchConfiguration.getKernelId())); createLaunchConfigurationRequest.setRamdiskId(emptyToNullStringMapper.map(launchConfiguration.getRamdiskId())); List<BlockDeviceMapping> list2 = launchConfiguration.getBlockDeviceMappings(); if (list2 != null) { createLaunchConfigurationRequest.setBlockDeviceMappings(new ArrayList<BlockDeviceMapping>(list2)); } else { createLaunchConfigurationRequest.setBlockDeviceMappings(null); } createLaunchConfigurationRequest.setInstanceMonitoring(launchConfiguration.getInstanceMonitoring()); createLaunchConfigurationRequest.setSpotPrice(emptyToNullStringMapper.map(launchConfiguration.getSpotPrice())); createLaunchConfigurationRequest.setIamInstanceProfile(emptyToNullStringMapper.map(launchConfiguration.getIamInstanceProfile())); createLaunchConfigurationRequest.setEbsOptimized(launchConfiguration.getEbsOptimized()); createLaunchConfigurationRequest.setAssociatePublicIpAddress(launchConfiguration.getAssociatePublicIpAddress()); createLaunchConfigurationRequest.setPlacementTenancy(emptyToNullStringMapper.map(launchConfiguration.getPlacementTenancy())); return createLaunchConfigurationRequest; }