autoscaling
This commit is contained in:
parent
bc2abe6124
commit
e3f3ad1e0b
@ -233,7 +233,7 @@ def create_load_balancer_listener(elbv2_client, load_balancer_arn, target_group_
|
|||||||
|
|
||||||
def create_auto_scaling_group(autoscaling_client, launch_template_id, target_group_arn, subnet_id_1, subnet_id_2):
|
def create_auto_scaling_group(autoscaling_client, launch_template_id, target_group_arn, subnet_id_1, subnet_id_2):
|
||||||
# Create Auto Scaling Group
|
# Create Auto Scaling Group
|
||||||
response = autoscaling_client.create_auto_scaling_group(
|
autoscaling_client.create_auto_scaling_group(
|
||||||
AutoScalingGroupName=f"{PREFIX}-asg",
|
AutoScalingGroupName=f"{PREFIX}-asg",
|
||||||
LaunchTemplate={
|
LaunchTemplate={
|
||||||
'LaunchTemplateId': launch_template_id,
|
'LaunchTemplateId': launch_template_id,
|
||||||
@ -256,8 +256,13 @@ def create_auto_scaling_group(autoscaling_client, launch_template_id, target_gro
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
print(f"Auto Scaling Group created with ARN: {response['AutoScalingGroups'][0]['AutoScalingGroupARN']}")
|
describe_response = autoscaling_client.describe_auto_scaling_groups(
|
||||||
return response['AutoScalingGroups'][0]['AutoScalingGroupARN']
|
AutoScalingGroupNames=[f"{PREFIX}-asg"]
|
||||||
|
)
|
||||||
|
|
||||||
|
asg_arn = describe_response['AutoScalingGroups'][0]['AutoScalingGroupARN']
|
||||||
|
print(f"Auto Scaling Group created with ARN: {asg_arn}")
|
||||||
|
return asg_arn
|
||||||
|
|
||||||
def put_scaling_policies(autoscaling_client, asg_arn):
|
def put_scaling_policies(autoscaling_client, asg_arn):
|
||||||
# Put Scaling Policies
|
# Put Scaling Policies
|
||||||
|
Loading…
Reference in New Issue
Block a user