DEV Community

Cover image for AWS OpsWorks to Deploy an Application
Kunal Shah
Kunal Shah

Posted on

AWS OpsWorks to Deploy an Application

AWS OpsWorks to Deploy an Application

AWS Cloud Hands on Lab Practice Series

Project Overview —

To deploy an PHP application using AWS OpsWorks. Building Layers, and in one of the Layers we will deploy an application instance.

SOLUTIONS ARCHITECTURE OVERVIEW -

First Let’s understand the real world use case -

  1. Application Lifecycle Management: OpsWorks can be used to automate the entire application lifecycle, including provisioning, deployment, scaling, and monitoring. It allows you to define the desired state of your application environment and automates the process of bringing it to that state, making it easier to manage and update applications.

  2. Continuous Integration and Continuous Deployment (CI/CD): OpsWorks can integrate with popular CI/CD tools like AWS Code Pipeline and Jenkins. This enables you to automate the build, test, and deployment processes for your applications, ensuring a streamlined and efficient CI/CD pipeline.

  3. Microservices Architecture: OpsWorks can be leveraged to manage and deploy microservices-based architectures. With OpsWorks, you can define individual stacks for each microservice, enabling independent deployment and scaling of different components of your application.

  4. Configuration Management: OpsWorks integrates with popular configuration management tools like Chef and Puppet, enabling you to define and manage infrastructure configurations as code. This simplifies the process of configuring and maintaining your resources consistently across multiple instances.

  5. Technology Industries — Gaming, Video Streaming and Media, Education and E-Learning, Fintech and Financial Services, Healthcare and Life Sciences, Travel and Hospitality etc.

AWS OpsWorks Stacks Benefits :

AWS OpsWorks is a configuration management service that provides managed instances of Chef and Puppet. Chef and Puppet are automation platforms that allow you to use code to automate the configurations of your servers. OpsWorks lets you use Chef and Puppet to automate how servers are configured, deployed, and managed across your Amazon EC2 instances or on-premises compute environments. OpsWorks has three offerings, AWS OpsWorks for Chef Automate, AWS OpsWorks for Puppet Enterprise, and AWS OpsWorks Stacks.

STEP BY STEP GUIDE -

we will learn more about the foundational element of OpsWorks, and use it to deploy an application. We will start with the stack, then build Layers, and in one of the Layers we will deploy an instance. Then on that instance, we will deploy an application.

PREREQUISITE —

AWS Services Usage —

AWS OpsWorks, EC2, ELB, IAM, VPC

STEP 1 :

  • Log into AWS Console & Search for AWS OpsWorks.

  • Navigate to OpsWorks Stack. Click Go to OpsWorks Stacks.

STEP 2 :

  • Click Add Your First Stack.

  • Choose Chef 11 stack, and then fill out the form below:

  • Stack name = Opsworks-stack-demo

  • Region = US East (your choice)

  • VPC = Default VPC CIDR.

  • Default Subnet = Public Subnet

  • Default Operating System = Amazon Linux 2018.03

  • The rest we can leave set to the defaults.

  • Click Add Stack.

STEP 3 :

  • Create a First Layer by clicking Add a Layer.

  • Select the Layer type (PHP App Server) from the dropdown.

  • In the Elastic Load Balancers dropdown, choose the one that is provided.

  • Leave Instance Shutdown Behavior set to Wait for an instance’s connections to drain.

  • Click Add layer.

STEP 4 :

  • Create a Second Layer by clicking Add a Layer.

  • Select the Layer type (MySQL) from the dropdown.

  • Leave rest of the form set to its defaults, and click Add layer.

STEP 5 :

  • Click on PHP App Server & edit the settings.

  • In the Network area set the Public IP addresses to Yes & Click Save.

STEP 6 :

  • Scroll back up and click on Instances in the left-hand menu.

  • Down near the bottom of this page, in the PHP App Server section, click Add an instance.

  • In the New tab, change the Size to t2.micro.

  • Click Add Instance.

  • With the instance created, click the start button that’s over in the Actions column.

  • Wait until it has a Status of online before moving on.

  • TIP — Check New EC2 Instance getting provisioned.

STEP 7 :

  • Choose Apps in left navigation & Click Add app.

  • In the web form that appears, set the Name to phpdemo and set the Data Source Type to None.

  • Select Git from the Repository type dropdown, and in the Repository URL, paste the URL from the Prerequisites.

  • https://github.com/Kunal-Shah107/OpsworksDemo

  • We’ll see our new app in the lower part of the screen. Click deploy in the Actions column. On the next screen, click the Deploy button.

  • Wait until we have a green successful appear as a status before moving on.

STEP 8 :

  • In the left navigation click on Instances.

  • Scroll down and click on our php-app1 instance.

  • Scroll farther down and right click on the public IP address (to open it in a new browser tab).

  • In that new tab, we should see a message reading “AWS OpsWorks Demo by acloudguy.in!

  • Congratulations !! That message means that we’ve completed the hands-on lab.

Pro Tip : Try Changing the application headings & do the redeployment. This will help you understand the benefits of CI/CD with AWS OpsWorks.

IMP NOTE — This DEMO/POC might incur some charges if kept active for long time. So please make sure to clean up the environment once done.

I am Kunal Shah, AWS Certified Solutions Architect, helping clients to achieve optimal solutions on the Cloud. Cloud Enabler by choice, DevOps Practitioner having 7+ Years of overall experience in the IT industry.

I love to talk about Cloud Technology, DevOps, Digital Transformation, Analytics, Infrastructure, Dev Tools, Operational efficiency, Serverless, Cost Optimization, Cloud Networking & Security.

aws #community #builders #devops #OpsWorks #infrastructure #Management #CICD #Chef #Puppet #Configurations

You can reach out to me @ acloudguy.in

Top comments (0)