AWS OpsWorks is a service which can be used to manage applications and can be used to operate applications of all shapes and sizes. In this blog we will discuss steps to automate a PHP app using AWS OpsWorks and Git. OpsWorks is an AWS service that can be used to automate the different kinds of app deployments. It is highly versatile as it can be used to deploy applications of Ruby, Java, PHP, Angular.js and node.js etc. OpsWorks basically uses chef in the backend for automation and configuration management purposes.
Refer here to know about launching an instance using AWS OpsWorks. Steps to deploy PHP app after successfully launching an instance using OpsWorks are listed below.
When we click on the Apps on AWS OpsWorks Console, then we will get console shown below.1) First of all generate a ssh keypair by:-
[js]ssh-keygen -t rsa [/js]
NOTE: We have to generate the ssh keypair for root user as OpsWorks deploys the app as root user.
Now, we copy the private SSH key generated which is present in the /root/.ssh/id_rsa, then:
In “Repository SSH key” we put the Private SSH Key of the instance, and further can be read here.
2) Click on “Add an app” button, we get console asking for details of the app. Choose the option as shown in the snapshot below:-
After filling all the details, click on “Add App” button at the bottom of page to add and list the app as shown below,
Now, we are going to deploy the app by clicking the “Deploy” button and check the satus of the app.
Wait for a few seconds to see our app running.
And now when we hit the address of the instance and we can check that our app is running.
Our basic idea of using AWS OpsWorks is to automate the app deployment, and when we push something on the repository, then we have to just click on deploy button, and all the changes will be successfully implemented.