Uncategorized

AWS Opswork Deployment

Opswork allows you to create and deploy a stack components. Opswork can be used with Chef’s Configuration Management tool. The Opswork service has several key features.
Automated deployment of software packages on operating system.
Ability to manage deployments and conduct Blue-Green Deployments, if necessary.
Integration with Chef 11 and 12.
Ability to attach a stack layer with a database and an elastic load balancer
This topic addresses Continuous Delivery and Process Automation as described in the AWS Blueprint exam guide.

What does the OpsWork Stack look?
The Opswork stack’s basic structure is shown in the below diagram by AWS

1) The definition of the stack is the first. There are many ways to have stacks. You could have stacks to support your staging environment and a separate one for production.
2) Next, add layers to the stack you have created. Multiple layers can be created. You can have multiple layers, such as one layer that represents the Operating System layer and another which represents Web server layer.
3) Next, you will create and deploy the apps to your Opswork stack
4) Finally, you will manage your Opswork stack. This includes adding new layers and modifying existing components.
Implementing OpsWork Stacks
Let’s now take a closer look at the Opswork stacks. In the following example, we will create an Opswork Stack using Chef11. We will use the AWS Opswork built-in recipes. Opswork will install nginx as a web server on the instances. Finally, we will deploy a demo.html page to the underlying instance. We assume that the code has been uploaded to a public GitHub repository.
Step 1: Log in to your AWS Console. Go to the Management Tools->OpsWorks section

Step 2: Create a stack. Click on the next screen to add your first stack.

Step 3: In the next screen, select a Chef 11 stack.

Step 4: Choose an operating system. You can only have one OS for a stack. You cannot mix and match OS systems. Let’s just say ‘No’ to the custom chef cookbooks. This setting can be edited once the stack has been created.

Step 5) Continue to build your stack.

Step 6: Once the stack has been created, click on the Layers section.

Step 7: Click on Add Layer in the Layers section.

Step 8: Next screen, choose the Layer type. In this example, we choose the static web server to install the nginx server. An Elastic Load Balancingr must be attached to your stack. The instances that are currently mapped to ELB will be deleted. The below snapshot shows that a load balancer was created from the previous.

After the layer has been created, you can view its settings.
a) The Recipes section will display the built-in recipes that you have selected for your stack. You can use your own cookbooks to create your own recipes and adjust the layer settings accordingly.

b) You also have the option to install custom packages based upon the OS in the OS Packages section.

c) The network section can be found below. This section allows you to choose the ELB to use, and whether to have Public or Elastic IP addresses.

d) The EBS Volumes are shown below

e) The Auto healing feature is located in the General section. Each instance has an AWS OpsWorks Stacks agent who communicates with the service on a regular basis. AWS OpsWorks Stacks uses this communication to monitor the health of each instance. AWS OpsWorks Stacks will consider an instance failed if the agent doesn’t communicate with the service for at least five minutes.

Step 9: Once the Layer has been added, click on the “Add instance” button to add an instance.

Step 10: Select the Instance type, then click on “Add Instance”.

Step 11: Once the instance has been added, click the start button to launch the instance.

Step 12: Once the instance has been launched, you will receive a Public IP

When you click on the Public IP address, you will be taken to the home page for the nginx webserver.

Step 13) Next look at deploying your application. Click on “Add app” in the Apps section.

Step 14) Select the following settings in the App section. In this case, choose ‘Static.

Step 15) Enter URL for source code. Step 15) Enter the URL for the source code.

If you need additional settings, you can add them.

Step 16: Once you have the app, click ‘Deploy’

Select the Deploy option. You have the option to deploy code to a specific set of instances or all instances when you deploy.

The following commands are available from the other commands:
a) Undeployment – T