Removing the instance creation

When using an Auto Scaling group, instance creation and termination is done by the service itself, therefore we can remove two blocks of code from our script.

The first one is the call to add the EC2 resource:

t.add_resource(ec2.Instance(...)) 

Now that the instance is gone, the second block that needs to be removed is the output that would previously list out the instance public IP and create the URL based on its public DNS name. At the bottom of the file, remove the two output sections:

t.add_output(Output( 
    "InstancePublicIp", 
    ... 
)) 
 
t.add_output(Output( 
    "WebUrl", 
... 
))  

Now that we have removed what we won't need anymore, we start adding the new resources needed to implement our Auto Scaling group, starting with the ELB.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset