Devops

Build Code Pipeline Using AWS OpsWorks

A Remote Delivery Success: From EBS and Hyperion to Oracle Cloud

AWS is a top cloud service provider, and DevOps is the ‘need of the hour’ implementation for the software development lifecycle. That is why many people wondered if they could implement DevOps on top of AWS, and AWS responded with a plethora of services that catered to these needs.

 

So, what are these services, and why is AWS DevOps a great combo?

Picture12
AWS provides various services like EC2 and various container services, which let us spawn certain instances. These instances are nothing but our virtual machines on top of which one can go ahead and host different kinds of applications, put in different kinds of data, etc. So, instances are a must, and these instances readily scale up and scale down to our needs, i.e., something which is very suitable for a DevOps approach. When we talk about DevOps, we’re talking about continuous integration and deployment, and to carry out these processes, we need these elastic and scalable instances. That need is served with AWS instances.

Moving further, AWS cloud formation is something that allows us to create templates and environments which we can use to host different kinds of applications.

AWS code pipeline allows us to create a pipeline in which we can add our data. This data is built into applications, tested several times, and committed to the repositories we wish to use. We can do it on GitHub, or we can use an in-house repository which is called an AWS code commit. So, again the purpose is served when we talk about building an application, deploying the code, testing the code, etc.

AWS CloudWatch is a monitoring service that keeps track of all the activities on the AWS platform.

 

What is AWS OpsWorks?

It is a configuration management service that helps to build and operate highly dynamic applications and propagate changes instantly.

In simple words, these days, we are constantly building multiple applications. So, if we think about it from an infrastructure perspective, we might be required to maintain hundreds of servers for different applications. On top of that, we have to configure those applications and do several activities we would not be interested in. Developers and business owners want to spend their time focusing on the business and the development part. This is where OpsWorks comes in, it takes care of the configuration and the management part, and when we talk about its service, it specifically helps us in various DevOps-related activities like deploying codes as well as the applications manually, automatically, and by ‘n’ number of other ways.

In regards to DevOps, these things can be done using chef and puppet. Automated platforms like Chef and Puppet permit users to use OpsWorks as a configuration code service to automate their server configurations. This makes managing the complete application lifecycle easy, including resource provisioning, configuration management, application deployment, software updates, monitoring, and access control.

 

AWS OpsWorks Components:

Picture13

Stacks and Layers:

  • Stacks: When we talk about building applications, basically, we’re talking about code, configuration files, installations, etc. All these things must lie inside a container where these things can be managed, so that stack of these resources is called a stack in AWS OpsWorks.
  • Layers: A sub-classification inside a stack is called a layer, i.e., a sub stack that basically allows us to have a more classified approach towards our resources. Every stack contains one or more layers, each of which represents a particular stack component.

Instances:

An instance is a virtual server in AWS Cloud. With Amazon EC2, we can set up and configure the operating systems and applications that run on the instances.

 

Applications:

It refers to software, a set of instructions or code written in a program for executing a task or operation for a particular purpose.

 

Cookbooks:

Cookbooks are essentially a collection of “recipes.” Recipes are just a script, i.e., our configuration file. A configuration file tells our service what to do, i.e., what kind of operation we want our service to perform. So, if we have an “N” number of such configuration files that tells our service what to do, we can club them together to form a cookbook.

3 Solutions with AWS OpsWorks to Configure your Infrastructure:

Now let us just go ahead and switch to the console part and try to see what AWS OpsWorks have to offer us:

Picture14

 

OpsWorks Stacks:

It defines, groups, provisions, deploys and operates our applications in AWS by using Chef in local mode.

 

OpsWorks for Chef Automate:

Creates Chef servers that include Chef Automate premium features and use the Chef DK or any Chef tooling to manage them.

 

OpsWorks for Puppet enterprise:

Creates Puppet servers that include Puppet Enterprise features. Inspect, deliver, update, monitor, and secure your infrastructure.

 

Let’s go with OpsWorks Stacks. When we click on “Add your first stack,” we will get the following three options:

Picture15

Let’s try out the “Sample stack” option and explore AWS OpsWorks Stacks with a sample Node.js app. If we try to create a stack without creating an IAM role, it will throw an error, as seen in the diagram. Hence, we must create an IAM role with AWS OpsWorks permissions, for example. Attach an AWS-managed policy with the name ‘AWSOpsWorks_FullAccess,’ which provides full access to AWS OpsWorks. Then it will redirect to a dashboard where we will get a “Explore the sample stack” option, after all, green checks as seen in the diagram below.

Picture16

Now, while exploring the sample stack, one important thing is that we need to go ahead and start an instance that takes some time for its booting process. Once it is up and running, it will be indicated in an “online” state, as seen in the below image.

Picture17

Let’s get into the deployment part, as the instance is up and running.

Simply click “Deployments à Settings,” then choose App name and Command as Deploy. So basically, this application would be deployed at our instance.

And that’s how it can be concluded that we have the freedom to choose the instances we want to bring in and use all the recipes and cookbooks we have. We can use configurations and instructions that we want to use that suit our needs better. Our applications can be large and run on any kind of platform, so all these restrictions won’t be there once we deploy our application or go ahead and decide to use AWS OpsWorks.

If we wish to look at what has happened, i.e., the reason it took some time to be in a running state was due to the number of operations and multiple processes it was executing in the background. If we check the Instance IP, it will be redirected to a webpage, as seen in the image below.

 

Picture18

Hence, we have successfully deployed our first app with AWS OpsWorks.

As these things might cost, it is very important that we clear all the stuff and that in a proper sequential manner. First, all the apps should be deleted, then instances should be stopped and terminated. Once we’ve deleted the applications and instances, only then will we be able to delete our stacks.

 

Thoughts on “Build Code Pipeline Using AWS OpsWorks”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Ajinkya Gadge

Ajinkya Gadge has over 3 years of IT experience in Cloud Domain and looks forward to writing more blogs for Perficient.

More from this Author

Subscribe to the Weekly Blog Digest:

Sign Up
Categories
Follow Us
TwitterLinkedinFacebookYoutubeInstagram