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 ...
Get Amazon EC2 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.