pcf.particle.aws.ec2.autoscaling package

Submodules

pcf.particle.aws.ec2.autoscaling.auto_scaling_group module

class pcf.particle.aws.ec2.autoscaling.auto_scaling_group.AutoScalingGroup(particle_definition, session=None)

Bases: pcf.core.aws_resource.AWSResource

This is the implementation of Amazon’s Auto Scaling group. This particle requires one of the following: a launch configuration, a launch template, or an EC2 instance to be included in the initial state definition or have those particles as a parent.

REMOVE_PARAM_FILTER = {'Instances', 'LifecycleHookSpecificationList', 'LoadBalancerNames', 'Tags'}
START_PARAM_FILTER = {'AutoScalingGroupName', 'AvailabilityZones', 'DefaultCooldown', 'DesiredCapacity', 'HealthCheckGracePeriod', 'HealthCheckType', 'InstanceId', 'LaunchConfigurationName', 'LaunchTemplate', 'LifecycleHookSpecificationList', 'LoadBalancerNames', 'MaxSize', 'MinSize', 'NewInstancesProtectedFromScaleIn', 'PlacementGroup', 'ServiceLinkedRoleARN', 'Tags', 'TargetGroupARNs', 'TerminationPolicies', 'UserData', 'VPCZoneIdentifier', 'instance-id'}
UNIQUE_KEYS = ['aws_resource.AutoScalingGroupName']
_set_unique_keys()

Logic that sets keys from state definition that are used to uniquely identify the Auto Scaling Group

_start()

start the autoscaling group particle that matches current state definition

Returns:response of boto3 create_auto_scaling_group()
_stop()

Logic that stops the particle. This is implemented for each individual particle

_terminate()

deletes the Auto Scaling group particle that matches the name

Returns:response of boto3 delete_auto_scaling_group()
_update()

Updates the Auto Scaling group that matches current state definition

Returns:response of boto3 update_auto_scaling_group()
equivalent_states = {<State.running: 1>: 1, <State.stopped: 2>: 0, <State.terminated: 3>: 0}
flavor = 'auto_scaling_group'
get_status()

Get the current status of your autoscaling group. Calls boto3 describe_auto_scaling_groups using asg_name

Returns:dict with the Auto Scaling group that matches the asg_name provided
is_state_definition_equivalent()

Determines if the current state definition matches the current state definition. Uses keep and remove function from pcf util to remove extra params in desired state that are not in the current state.

Returns:bool
sync_state()

Sync state calls get_status to determines and the state of the Auto Scaling group particle.

pcf.particle.aws.ec2.autoscaling.launch_configuration module

class pcf.particle.aws.ec2.autoscaling.launch_configuration.LaunchConfiguration(particle_definition, session=None)

Bases: pcf.core.aws_resource.AWSResource

This is the implementation of Amazon’s Launch Configuration.

UNIQUE_KEYS = ['aws_resource.LaunchConfigurationName']
_set_unique_keys()

Logic that sets keys from state definition that are used to uniquely identify the Auto Scaling Group Launch Configuration

_start()

start the launch configuration particle that matches current state definition

Returns:response of boto3 create_launch_configuration()
_stop()

Launch configuration does not have a stopped state so it calls terminate.

_terminate()

deletes the launch configuration particle that matches the name

Returns:response of boto3 delete_launch_configuration()
_update()

Not Implemented

equivalent_states = {<State.running: 1>: 1, <State.stopped: 2>: 0, <State.terminated: 3>: 0}
flavor = 'launch_configuration'
get_status()

Get the current status of your launch configuration particle. Calls boto3 describe_launch_configurations using lc_name

Returns:dict with the launch configuration particle that matches the lc_name provided
sync_state()

Sync state calls get_status to determines and the state of the launch configuration particle.

Module contents