Table of contents
1.
Introduction
2.
Setting Up AWS Opsworks Stack
2.1.
Creating AWS Account
2.2.
Setting Up IAM User
2.3.
Assigning Services
3.
Creating a Stack Using AWS Opsworks Stack
4.
Working with Layer on Stack
5.
Deploying the App on the Instance
6.
Launching the Instance
7.
Frequently Asked Questions
7.1.
What is an AWS Opsworks stack?
7.2.
How are AWS OpsWorks Stacks and AWS OpsWorks for Chef Automate different?
7.3.
How do I get to the AWS OpsWorks Stacks?
8.
Conclusion
Last Updated: Mar 27, 2024
Easy

AWS Opsworks Stacks with Linux

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

When you step in as a software developer, the first thing you do when you are provided with a project is make a software model. We have a habit of working either in a top-to-bottom or bottom-to-top fashion, but ultimately, we work at a single thing at a time. This thing is what we call a layer.

Now, if you are working on AWS, then how to manage applications and servers in the layers? Don’t worry because we have a tool here. It is called AWS Opsworks stacks.

aws opsworks stacks with linux

This article will briefly discuss AWS Opsworks stacks with Linux. We will start our discussion by setting up the AWS Opsworks stack. Afterward, we will create a stack and add a layer to the stack. At last, we will deploy the app on the instances and discuss the steps to launch this instance.

So without further ado, let’s get started!

Setting Up AWS Opsworks Stack

We will start this article considering you are new to AWS and are just beginning with AWS Opsworks stacks with Linux. A stack is a group of AWS resources we manage as a single unit. 

You can skip directly to the next section if you have already set up an IAM user and have given the required permission.

Well, if you don’t know about IAM users, it is a type of resource in IAM which is associated with permissions and credentials.

To set up the AWS Opsworks stack, we must create an IAM user in an AWS account. We will set up an AWS account and give the IAM user access permissions to AWS OpsWorks Stacks.

setting up aws opswork

Creating AWS Account

To create an AWS account, you can visit the AWS sign-up page

A root user for your AWS account is created when you sign up. All AWS resources and services in the account are accessible to the root user. As a security best practice, give an administrative user access to the system and only use the root user for operations that need root user access.

Setting Up IAM User

You are creating an AWS Identity and Access Management (IAM) user using your AWS account. To access the AWS OpsWorks Stacks service, you use an IAM user. (We don't advise you to access AWS OpsWorks Stacks using your AWS account directly. This can make it more challenging for you to troubleshoot service access issues later and is typically less secure.) 

Assigning Services

We can enable access to the AWS OpsWorks Stacks service and configure your IAM user (and related services that AWS OpsWorks Stacks relies on).

IAM provides you with the resources to develop and oversee all IAM policies (managed and inline). An IAM identity (IAM user, group, or role) can be added permissions by creating a policy, validating it, and then attaching it to the identity. An identity can have multiple policies attached to it, and each policy can have some permissions.

You can use the IAM user you already have or the one you created in the previous step to attach the AWSOpsWorks_FullAccess and AmazonS3FullAccess policies.

Creating a Stack Using AWS Opsworks Stack

To create a stack, use the AWS OpsWorks Stacks console. A stack is a grouping of related instances and AWS resources that serve the same purpose and is managed jointly.

creating stack

For creating a stack, refer to the following steps:

⭐ Sign in to the AWS OpsWorks Stacks using IAM user.

⭐ If any of the following apply, take action:

👉 Select Add your first stack if the Welcome to AWS OpsWorks Stacks page appears. It shows the Add stack page.

👉 Select Add stack if the OpsWorks Dashboard page appears. It shows the Add stack page.

 

⭐ If Chef 12 stack hasn't already been selected for you on the Add stack page, do so now.

⭐ Type a name in the Stack name box.

⭐ Select South Asia (India) in the region box.

⭐ You can choose VPC if available otherwise, No VPC.

⭐ In the Repository type, select HTTP Archive.

⭐ For the Repository URL, type https://s3.amazonaws.com/opsworks-demo-assets/opsworks-linux-demo-cookbooks-nodejs.tar.gz

⭐ Select Linux and Ubuntu 18.04 LTS as your default operating system.

⭐ Select Yes under Use custom Chef cookbooks.

⭐ Now choose Advanced.

⭐ In the Advanced section, let these values at default,

Default Availability Zone, Default SSH key, User name, Password, Stack colour 

⭐Select Add Stack. The stack is created by AWS OpsWorks Stacks, which also renders the MyLinuxDemoStack page.

Working with Layer on Stack

A layer is a set of instances, just like Amazon EC2 instances. It contains details about the resources, installed packages, security groups, and instance settings. Add a layer to the stack after that.

For adding a layer to the stack:

⭐ When the MyLinuxDemoStack page is displayed, select Add a layer under Layers.

⭐ Now, the Add Layer page is shown. Type MyLinuxDemoLayer on OpsWorks Tab in the Name field. You can also type Demo for a short name.

⭐ Now select Add layer. The layer is created by AWS OpsWorks Stacks, which also shows the Layers page.

⭐ Select Network for MyLinuxDemoLayer on the Layers page.

⭐ Make sure Public IP addresses are set to yes under Automatically Assign IP Addresses on the Network tab. Select Save if you've made changes.

⭐ Now select Security on the layers page.

⭐ The layer on the MyLinuxDemoLayer page is the Security tab. Select AWS-OpsWorks-WebApp for Security groups, and then click Save.

 

✨ Now the AWS-OpsWorks-WebApp is been added.

Deploying the App on the Instance

Do you know AWS OpsWorks Stacks defines an app as code you want to run on an instance? 

To deploy the app, we will follow these steps:

⭐ Select Apps from the service navigation pane.

⭐ Now, the Apps page is visible. Choose to Add an app.

⭐ Enter MyLinuxDemoApp in the Name field of Settings.

⭐ For the Repository URL, type https://github.com/awslabs/opsworks-windows-demo-nodejs.git

⭐  You should let the following value at default:

Settings, Document root, Data Sources, Data source type, Repository type, Repository SSH key, Branch/Revision, Environment Variables, Add Domains, Domain Name, SSL Settings, and Enable SSL.

⭐ Select Add App. The app is added, and AWS OpsWorks Stacks show the Apps page.  

 

✨ Now, you have successfully deployed the app on the instances.

Launching the Instance

We will first start an Ubuntu Server Amazon EC2 instance. It will use the setting of the layer we created while working with the layer on the stack.

For launching the instance, we will follow these steps:

⭐ Select the Instance in the service navigation pane.

⭐ For implementing MyLinuxDemoLayer, we will choose to Add an instance.

⭐ You should leave default for hostnamesize, and subnet.

⭐ Now choose Advanced.

⭐ In the Advanced section, let these values at default

Scaling type, SSH key, Operating system, OpsWorks Agent version, Tenancy, Root device type, Volume type, and Volume size.

⭐ If you want to add the instance to the layer and display the Instances page. Select Add Instance.

 

If you implement the above steps correctly, then,

⏳ During the next few minutes, the following happens:

👉 The establishing circle moves from 0 to 1.

👉 Status changes in the following way, from stopped to requested, to pending, to booting, to running setup, and finally to online. These steps can take a while, so sit back and relax. 

👉 The setting-up circle indicator changes from 1 to 0 after the status changes to online. The online circle changes from 0 to 1 and turns bright green. Wait until the online circle turns bright green and displays one instance of online activity before moving on.

If you get this ss, then your launch is complete.

output

Frequently Asked Questions

What is an AWS Opsworks stack?

You can manage servers and applications on AWS and on-premises using AWS OpsWorks Stacks. You can model your application as a stack made up of various layers, such as load balancing, database, and application server, using OpsWorks Stacks.

How are AWS OpsWorks Stacks and AWS OpsWorks for Chef Automate different?

A configuration management service called OpsWorks for Chef Automate enables you to quickly provision a Chef server and give the service control over it so it can run backups and software updates. Using the embedded Chef solo client pre-installed on Amazon EC2 instances on your behalf, the OpsWorks Stacks service aids in the modelling, provisioning, and managing of your applications on AWS.

How do I get to the AWS OpsWorks Stacks?

The AWS Management Console, AWS SDKs, and the AWS Command Line Interface provide access to AWS OpsWorks Stacks.

Conclusion

This article briefly discussed AWS Opsworks stacks with Linux. We started our discussion by setting up the AWS Opsworks stack. Afterward, we created a stack and added a layer to the stack. At last, we deployed the app on the instances and discussed the steps to launch this instance, thus concluding our discussion on AWS Opsworks stacks with Linux.

We hope that this blog has helped you enhance your knowledge about the topic of AWS Opsworks stacks with Linux. If you like to learn more, you can check out our articles: 

🌐 Introduction to AWS

🌐 AWS Features

🌐 Global Infrastructure Concept in AWS

🌐 AWS SAML

Refer to our Guided Path on Coding Ninjas Studio to upskill yourself in Data Structures and AlgorithmsCompetitive ProgrammingJavaScriptAWS and many more! If you wish to test your competency in coding, you may check out the mock test series and participate in the contests hosted on Coding Ninjas Studio! 

If you have just started your learning process and are looking for questions asked by tech giants like Amazon, Microsoft, Uber, etc. In that case, you must look at the problemsinterview experiences, and interview bundles for placement preparations.

Nevertheless, you may consider our paid courses to give your career an edge over others!

Do upvote our blogs if you find them helpful and engaging!

Happy Learning!

Live masterclass