Template deployment

Now, let's look at how we can deploy the template through the console. Follow these steps to get started:

  1. We need to navigate to the CloudFormation management console and click on the Create new stack button:

  1. We need to upload a template to Amazon S3 and select the file from the samples provided by clicking Choose file, selecting the file, and then clicking Next:

  1. In the Specify Details section, we will be required to name the stack and specify the parameters that are defined in the template. We will need to select an instance type from the list and an EC2 key pair from any of our existing key pairs and then click Next:

  1. In the Options section, we have the ability to add tags to the stack. Adding tags is highly recommended so that we can easily identify the resources that have been created by the stack when browsing other management consoles. Optionally, we can also assign a role that CloudFormation will use to create these resources:

  1. When running fully automated template deployments, rollback triggers are an important part of the configuration as they can automatically help us to determine whether the application has been deployed successfully or not. Additionally, we can also set advanced options for our stack like a stack policy that can help us to secure the stack. Once we are done with these settings, we can click Next:

  1. We are presented with a review window in which we can verify our selections and configurations of the CloudFormation stack. We are presented with the template URL and the details from the second step:

  1. We are also met with options such as tags and rollback that we configured in the previous step. Once we are happy with these selections, we can click Create to initiate the creation of the stack:

  1. The stack will start to be created and will initially be seen with a status of CREATE_IN_PROGRESS:

  1. After stack creation completes, we will see the status change to CREATE_COMPLETE. We can click on the stack and then select the Outputs tab on the bottom. Here, we have the instance ID and the IP address to which we can now test our SSH connection to:

  1. To connect to the IP, use your favorite SSH client with your ssh key. To verify that the instance's public IP address is really the one we want to connect to, you can run the following command, which looks up the public IP from an external service:
curl https://ipinfo.io/ip

Let's look at the following output:

Our stack was successfully deployed and our instance is running. We were able to connect to the instance because a security group allowing SSH was created by the template and the SSH key that we specified in the template creation process was added to this instance. 

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

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