IcsAS Common Library

IcsAS: Library for Auto Scaling

This is the IcsAS common library.
class opslib.icsas.IcsAS(region, **kwargs)[source]

ICS Library for AutoScale

__dict__ = <dictproxy object at 0x3f710c0>
__init__(region, **kwargs)[source]
__module__ = 'opslib.icsas'
__weakref__

list of weak references to the object (if defined)

create_launch_config(launch_config)[source]

Create the Launch Configuration

Parameters:launch_config (class) – boto launch_config object
Return type:string
Returns:AWS request Id
delete_launch_config_from_name(name)[source]

Delete the Launch Configuration from its name

Parameters:name (string) – the name of launch configuration
Return type:string
Returns:AWS request Id
get_group_from_name(name)[source]

Get the ASG from its name

Parameters:name (string) – the ASG name
Return type:list
Returns:a list represents the specific ASG(s)
get_group_name_from_instance(instance_id)[source]

Get the ASG name from the specific instance id

Parameters:instance_id (string) – EC2 instance id startwith ‘i-xxxxxxx’
Return type:string
Returns:name of the ASG, this instance belongs to
get_instances_from_group_name(name)[source]

Get the instance from the specific ASG name

Parameters:name (string) – the specific ASG name
Return type:list
Returns:a list contains all the instances
get_launch_config_from_name(name)[source]

Get the Launch Configuration from its name

Parameters:name (string) – the Launch Configuration name
Return type:list
Returns:a list represents the specific Launch Configuration(s)
resume_scaling_group(name, scaling_processes=None)[source]

Resumes Auto Scaling processes for an Auto Scaling group.

Parameters:
  • name (string) – the ASG name
  • scaling_processes (string or list) –

    scaling process names

    • Launch
    • Terminate
    • HealthCheck
    • ReplaceUnhealthy
    • AZRebalance
    • AlarmNotification
    • ScheduledActions
    • AddToLoadBalancer
suspend_scaling_group(name, scaling_processes=None)[source]

Suspends Auto Scaling processes for an Auto Scaling group.

Parameters:
  • name (string) – the ASG name
  • scaling_processes (string or list) –

    scaling process names

    • Launch
    • Terminate
    • HealthCheck
    • ReplaceUnhealthy
    • AZRebalance
    • AlarmNotification
    • ScheduledActions
    • AddToLoadBalancer
terminate_group_instance(instance_id, decrement_capacity=True)[source]

Terminates the specified instance. The desired group size can also be adjusted, if desired.

Parameters:
  • instance_id (str) – The ID of the instance to be terminated.
  • decrement_capacity – Whether to decrement the size of the autoscaling group or not.
to_list(input)[source]

Validate input, if not list, but string, make it as a list

update_instance_health(instance_id, health_status, grace_period=False)[source]

Explicitly set the health status of an instance.

Parameters:
  • instance_id (str) – The identifier of the EC2 instance
  • health_status (str) – The health status of the instance.
  • Healthy: the instance is healthy and should remain in service.
  • Unhealthy: the instance is unhealthy. Auto Scaling should terminate and replace it.
Parameters:grace_period (bool) – If True, this call should respect the grace period associated with the group.
update_launch_config(name, launch_config)[source]

Update the Launch Configuration for specific ASG

Parameters:
  • name (string) – the name of Auto-Scaling Group
  • launch_config (class) – boto launch_config object
Return type:

string

Returns:

AWS request Id

class opslib.icsas.RawAS(region)[source]

Raw Library for AutoScale, based on Botocore

__dict__ = <dictproxy object at 0x3f710c0>
__init__(region)[source]

Initialize the proper botocore service

__module__ = 'opslib.icsas'
__weakref__

list of weak references to the object (if defined)

create_group(group_config)[source]

Create a new Auto-Scaling Group

Parameters:group_config (dict) – auto-scaling group configuration
create_launch_config(launch_config)[source]

Create a new Launch Configuration

Parameters:launch_config (dict) – launch configuration
delete_group(name)[source]

Delete an existing Auto-Scaling Group

Parameters:name (string) – auto-scaling group name
delete_launch_config(name)[source]

Delete an existing Launch Configuration

Parameters:name (string) – launch configuration name
delete_scaling_policy(scaling_policy, metric_alarm)[source]

Delete an existing Scaling Policy

Parameters:
  • scaling_policy (dict) – scaling policy configuration
  • metric_alarm (dict) – metric alarm configuration
fetch_all_groups()[source]

Fetch all the Auto-Scaling Groups

Return type:dict
Returns:JSON object for all the Auto-Scaling Groups
fetch_group(name)[source]

Fetch an existing Auto-Scaling Group

Parameters:name (string) – auto-scaling group name
fetch_launch_config(name)[source]

Fetch an existing Launch Configuration

Parameters:name (string) – launch configuration name
find_groups(filter={})[source]

Find the names of Auto-Scaling Groups in the filters

Parameters:filter (dict) – a dictionary to used for resource filtering The format should be consistent with botocore JSON output
{
  "Tags": [
    {
      "Key": "Owner",
      "Value": "Production"
    }
  ]
}
Return type:list
Returns:a list containing all the names of filtered groups
handle_response(response)[source]

Handle the botocore response

kill_group(group_name, force=False)[source]

Delete a new Auto-Scaling Group

Parameters:
  • name (string) – launch configuration name
  • force (boolean) – whether to delete the auto-scaling group forcely
launch_group(group_config, launch_config)[source]

Launch a new Auto-Scaling Group

Parameters:
  • group_config (dict) – auto-scaling group configuration
  • launch_config (dict) – launch configuration
modify_group(group_config)[source]

Modify the Auto-Scaling Group

Parameters:group_config (dict) – auto-scaling group configuration
modify_launch_config(launch_config, delimiter='_U_')[source]

Modify the Launch Configuration

Parameters:launch_config (dict) – launch configuration
new_scaling_policy(scaling_policy, metric_alarm)[source]

Create a new Scaling Policy

Parameters:
  • scaling_policy (dict) – scaling policy configuration
  • metric_alarm (dict) – metric alarm configuration
update_group(group_config, launch_config)[source]

Update the Auto-Scaling Group

Parameters:
  • group_config (dict) – auto-scaling group configuration
  • launch_config (dict) – launch configuration
opslib.icsas.get_region(region_name, **kw_params)[source]

Find and return a boto.ec2.autoscale.RegionInfo object given a region name.

Parameters:region_name (str) – The name of the region.
Return type:boto.ec2.autoscale.RegionInfo
Returns:The RegionInfo object for the given region or None if an invalid region name is provided.

Indices and tables

Table Of Contents

Previous topic

IcsELB Common Library

Next topic

IcsS3 Common Library

This Page