Deploying applications on EC2 instances
You can deploy your applications on EC2 instances using AWS CloudFormation. In this AWS CloudFormation template, for example, we will install an Apache server and deploy code to it. We also create EIP, SecurityGroup, and EC2 resources. Image ID, instance type, VPC ID, subnet ID, a name for the instance, and key/pair names are required parameters to run this recipe. As this is a public facing web application, use the public subnet in your VPC.
How to do it…
Follow the steps to install an Apache server and deploy some code to it:
- Create the CloudFormation template file JSON file (named
apachewebserverdeployment.json
) with the following content:{ "AWSTemplateFormatVersion" : "2010-09-09", "Description" : "AWS CloudFormation template for Apache Server.", "Parameters" : { "ImageId" : { "Description" : "AMI Id.", "Type" : "String"...