Table of contents
1.
Introduction
2.
Creating OpsWorks using CloudFormation
2.1.
Using Console
2.2.
Using CLI
3.
Update an OpsWorks
4.
Regenerate the starter kit
5.
Working with Tags
5.1.
AWS Console
5.2.
AWS CLI
6.
Frequently Asked Questions
6.1.
How does a puppet work?
6.2.
Define Storage Gateway in AWS.
6.3.
What is Chef in AWS?
7.
Conclusion
Last Updated: Mar 27, 2024
Medium

Some Important Concepts of AWS Opsworks in Puppet Enterprise

Author Sagar Mishra
1 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Hey Ninjas! You must have heard about cloud storage. It is available for mobile or PC to store your data. Do you know who the best service provider for the cloud is? Yes, It is none other than AWS (Amazon Web Server). AWS offers many services to their users, like Ops work, CodeDeploy, Lambda, etc.

Some important concepts of AWS Opsworks in Puppet Enterprise.

Today, we will talk about some important concepts of AWS Opsworks in Puppet Enterprise.

Creating OpsWorks using CloudFormation

In this section, we will learn how to create AWS OpsWorks for Puppet Enterprise Master (PEM) using AWS CloudFormation. You can run a Puppet Enterprise server on AWS using AWS OpsWorks for Puppet Enterprise. A Puppet Enterprise master server may be set up within 15 minutes.

There are two ways to create a PEM.

⚡ Using Console.

⚡ Using CLI.

Using Console

Let's take a look at the steps shown below.

🚩 Open the AWS CloudFormation console after logging into the AWS Management Console.

🚩 Click on Create Stack on the CloudFormation home page.

🚩 Prepare a template in Prerequisites.

🚩 Select the source of your template in Specify Template.

🚩 Give a name to your stack on the Specify stack details page. Give the admin password in the Parameters.

🚩 You can give IAM role only if you have not yet given and also you can add tags to the server you are creating with the stack.

🚩 Review your inputs and click on Create.

Using CLI

Download and install the AWS CLI in your system. You can follow the installation guide for reference.

⭐ Complete all the prerequisites before creating an OpsWorks for PEM.

⭐ Now, you have to create a service role and an instance profile. For creating both of these, AWS Opsworks provides an AWS CloudFormation template. Run the command below to create the AWS CloudFormation stack.

aws cloudformation create-stack --stack-name OpsWorksCMRoles --template-url https://s3.amazonaws.com/opsworks-cm-us-east-1-prod-default-assets/misc/opsworks-cm-roles.yaml --capabilities CAPABILITY_NAMED_IAM

 

Now, Find and copy the ARNs of service roles in your account after you are done with creating the stack.

aws iam list-roles --path-prefix "/service-role/" --no-paginate

 

Make a note of the given service role ARNs entries. Include them in the AWS CloudFormation template you are utilizing to create your Puppet master server stack.

{
    "AssumeRolePolicyDocument": {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Action": "sts:AssumeRole",
                "Effect": "Allow",
                "Principal": {
                    "Service": "ec2.amazonaws.com"
                }
            }
        ]
    },
    "RoleId": "AROZZZZZZZZZZQG6R22HC",
    "CreateDate": "2022-10-17T20:42:20Z",
    "RoleName": "aws-opsworks-cm-ec2-role",
    "Path": "/service-role/",
    "Arn": "arn:aws:iam::000000000000:role/service-role/aws-opsworks-cm-ec2-role"
},
{
    "AssumeRolePolicyDocument": {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Action": "sts:AssumeRole",
                "Effect": "Allow",
                "Principal": {
                    "Service": "opsworks-cm.amazonaws.com"
                }
            }
        ]
    },
    "RoleId": "AROZZZZZZZZZZZZZZZ6QE",
    "CreateDate": "2022-10-17T20:42:20Z",
    "RoleName": "aws-opsworks-cm-service-role",
    "Path": "/service-role/",
    "Arn": "arn:aws:iam::000000000000:role/service-role/aws-opsworks-cm-service-role"
}

 

⭐ Rerun the create-stack command to create the OpsWorks for Puppet Enterprise master.

aws cloudformation create-stack --stack-name stack_name --template-body file://template.yaml or json --parameters ParameterKey=AdminPassword,ParameterValue="password"

 

⭐ You can also check the stack creation status by running the below command.

aws cloudformation describe-stacks --stack-name stack_name 

 

⭐ Now, you can move to the next section.

Update an OpsWorks

Update an OpsWorks

In this section, you will learn how to update an OpsWorks for Puppet Enterprise server to use a custom domain. We will use the backup of a server to create a new server.


Follow the steps given below to update your OpsWorks.

🍁 Make a copy of your puppet master by running the create server command.

🍁 Check if your server has a service role and instance profile. Click here and follow steps 1 to 5 if you don't have a service role and instance profile ARNs available.

🍁 Run the command to check the backups in your account.

aws opsworks-cm --region region name describe-backups

 

🍁 Run "create-server" to create the OpsWorks for the Puppet Enterprise server.

aws opsworks-cm create-server --engine "Puppet" --engine-model "Monolithic" --engine-version "2019" --server-name "server_name" --instance-profile-arn "instance_profile_ARN" --instance-type "instance_type" --engine-attributes '{"PUPPET_ADMIN_PASSWORD":"ASCII_password"}' --key-pair "key_pair_name" --preferred-maintenance-window "ddd:hh:mm" --preferred-backup-window "ddd:hh:mm" --security-group-ids security_group_id1 security_group_id2 --service-role-arn "service_role_ARN" --subnet-ids subnet_ID

 

Let's understand the creation of PEM using an example.

aws opsworks-cm create-server \
    --engine "Puppet" \
    --engine-model "Monolithic" \
    --engine-version "2019" \
    --server-name "puppet-02" \
    --instance-profile-arn "arn:aws:iam::1019881987024:instance-profile/aws-opsworks-cm-ec2-role" \
    --instance-type "c4.large" \
    --engine-attributes '{"PUPPET_ADMIN_PASSWORD":"zZZzDj2DLYXSZFRv1d"}' \
    --custom-domain "my-puppet-master.my-corp.com" \
    --custom-certificate "-----BEGIN CERTIFICATE----- EXAMPLEqEXAMPLE== -----END CERTIFICATE-----" \
    --custom-private-key "-----BEGIN RSA PRIVATE KEY----- EXAMPLEqEXAMPLE= -----END RSA PRIVATE KEY-----" \
    --key-pair "amazon-test" 
    --preferred-maintenance-window "Mon:08:00" \
    --preferred-backup-window "Sun:02:00" \
    --security-group-ids sg-b00000001 sg-b0000008 \
    --service-role-arn "arn:aws:iam::044726508045:role/service-role/aws-opsworks-cm-service-role" \
    --subnet-ids subnet-383daa71

 

🍁 This may take time. Do not close the tab, as it may contain important data that is not shown again.

Use the Endpoint attribute if you are using a custom domain. Here is an example.

"Endpoint": "puppet-2019-exampleexample.opsworks-cm.us-east-1.amazonaws.com"

 

🍁 You are now done with your update. After this step, your server will be created successfully.

Regenerate the starter kit

Regenerate the starter kit

The Starter Kit has a README file with examples and a private key for admin. Using AWS CLI only, we can regenerate the starter kit.

 

Run the update-server-engine-attributes command to regenerate the starter kit. Then go to AWS CLI and run the below command.

aws opsworks-cm update-server-engine-attributes \
   --server-name server_name \
   --attribute-name "PUPPET_ADMIN_PASSWORD" \
   --attribute-value new_password

 

The output will give you all the info about the server and a base64-encoded ZIP file.

Working with Tags

In this section, we will see the working of tags on the AWS OpsWorks for PER (Puppet Enterprise Resources).

We can add tags to the given resources.

🧊 OpsWorks for Puppet Enterprise servers.

🧊 Backups of OpsWorks for Puppet Enterprise servers.

Let's check out how many ways we can use tags in both Console and CLI in AWS.

AWS Console

We can use tags in many ways in OpsWorks for Puppet Enterprise Server (Console).

⭐ Add Tags to a New OpsWorks for PES.

⭐ Add/View Tags on an Existing Server.

⭐ Delete Tags from a Server.

⭐ Add Tags to a New Backup.

⭐ Add/View Tags on an Existing Backup.

⭐ Delete Tags from a Backup.

AWS CLI

⭐ Add Tags to a New OpsWorks for PES (Puppet Enterprise Services).

⭐ Add Tags to a New Backup.

⭐ Add Tags to Existing Servers or Backups.

⭐ List Resource Tags.

⭐ Delete Tags from a Resource.

Frequently Asked Questions

How does a puppet work?

A puppet offers the ability to define the software and config that a system needs and then, after initial setup, maintain a given state. It uses a declarative DSL to provide the config settings for a particular design or environment.

Define Storage Gateway in AWS.

A user can access nearly infinite cloud storage on-premises with the help of the hybrid cloud storage service known as AWS Storage Gateway. You can use AWS storage with Storage Gateway's standard set of storage protocols. Examples are iSCSI, SMB, and NFS, without changing how your current applications work.

What is Chef in AWS?

Chef is an automation platform that enables you to scale up the automation of basic tasks. Both Linux or Windows servers and Amazon EC2 instances can be managed with Chef.

Conclusion

This article discusses some important concepts of AWS Opsworks in Puppet Enterprise. In detail, we have seen how to create OpsWorks using CloudFormation, how to update OpsWorks, and regenerate the starter kit.

We hope this blog has helped you enhance your knowledge of important Concepts of AWS Opsworks in Puppet Enterprise. If you want to learn more, check out our articles.

⚡ AWS Shield.

⚡ AWS WAF.

⚡ Amazon Macie.

⚡  STS Download

And many more on our platform Coding Ninjas Studio.

Refer to our Guided Path to upskill yourself in DSACompetitive ProgrammingJavaScriptSystem Design, and many more! If you want to test your competency in coding, you may check out the mock test series and participate in the contests hosted on Coding Ninjas Studio!

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

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

Happy Learning!

Live masterclass