Method: Fog::AWS::AutoScaling::Real#create_launch_configuration
- Defined in:
- lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb
#create_launch_configuration(image_id, instance_type, launch_configuration_name, options = {}) ⇒ Object
Creates a new launch configuration. Once created, the new launch configuration is available for immediate use.
Parameters
-
image_id<~String> - Unique ID of the Amazon Machine Image (AMI) which was assigned during registration.
-
instance_type<~String> - The instance type of the EC2 instance.
-
launch_configuration_name<~String> - The name of the launch configuration to create.
-
options<~Hash>:
-
‘BlockDeviceMappings’<~Array>:
-
‘DeviceName’<~String> - The name of the device within Amazon EC2.
-
‘Ebs.SnapshotId’<~String> - The snapshot ID.
-
‘Ebs.VolumeSize’<~Integer> - The volume size, in GigaBytes.
-
‘VirtualName’<~String> - The virtual name associated with the device.
-
-
‘InstanceMonitoring’<~Hash>:
-
‘Enabled’<~Boolean> - Enabled detailed monitoring.
-
-
‘KernelId’<~String> - The ID of the kernel associated with the EC2 AMI.
-
‘KeyName’<~String> - The name of the EC2 key pair.
-
‘RamdiskId’<~String> - The ID of the RAM disk associated with the EC2 AMI.
-
‘SecurityGroups’<~Array> - The names of the security groups with which to associate EC2 instances.
-
‘UserData’<~String> - User data available to the launched EC2 instances.
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘ResponseMetadata’<~Hash>:
-
‘RequestId’<~String> - Id of request
-
-
-
See Also
docs.amazonwebservices.com/AutoScaling/latest/APIReference/API_CreateLaunchConfiguration.html
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb', line 47 def create_launch_configuration(image_id, instance_type, launch_configuration_name, = {}) if block_device_mappings = .delete('BlockDeviceMappings') block_device_mappings.each_with_index do |mapping, i| for key, value in mapping .merge!({ format("BlockDeviceMappings.member.%d.#{key}", i+1) => value }) end end end if security_groups = .delete('SecurityGroups') .merge!(AWS.indexed_param('SecurityGroups.member.%d', [*security_groups])) end if ['UserData'] ['UserData'] = Base64.encode64(['UserData']) end request({ 'Action' => 'CreateLaunchConfiguration', 'ImageId' => image_id, 'InstanceType' => instance_type, 'LaunchConfigurationName' => launch_configuration_name, :parser => Fog::Parsers::AWS::AutoScaling::Basic.new }.merge!()) end |