CloudThat's Blog
www.cloudthat.com
  • AWS
  • Azure
  • AI/ML
  • Data Analytics
  • DevOps
  • GCP
  • Cybersecurity
  • Test Prep
  • Training
  • Consulting

Running-Commands-Using-AWS-Systems-Manager-A-Step-by-Step-Guide
Shyla J Shyla J

Running Commands Using AWS Systems Manager: A Step-by-Step Guide

May 21, 2021 | Comments(14) |

AWS Systems Manager (formerly known as AWS SSM) is an AWS service used to view and control AWS infrastructure. It provides a solution to automate the operational tasks for Amazon instances. It lets engineers manage the configuration of the managed instances remotely and securely. AWS System Manager is an AWS service that helps in maintaining the servers. You can automate the process and perform desired tasks on the servers without logging into the system.

Having several servers seems to be a great way for efficient utilization. But the maintenance of the servers can be tedious enough to put a huge overall cost. The engineers must log in to the machines, list the patches, select, and install the same. This sounds to be easy, but it becomes cumbersome when a bunch of machines must be maintained. It would take more time and is a manual task affecting the performance. Additionally, this may also cause manual errors like, missing instances, missing packages during the process and creating issues.

The AWS Systems Manager is a powerful tool with varied capabilities categorized into operational management, application management, change management, node management, shared resources.
Today we will focus on the ‘Run Command’ targeted to simplify operational management tasks.

Run Command: 

It is a capability of the AWS Systems manager that allows you to remotely maintain and manage the servers. Managed servers are servers that have been configured for use by SSM service.

With Run Command, we can perform:

  • Adhoc exceptions. and
  • one-time configuration changes

Follow the guide below for a demo on how to use the Run command.

Prerequisites: 

You will need an AWS Account to begin with. If you are new to AWS or do not have an account, you can create one using this link:

https://aws.amazon.com/free/

Here is a step-by-step guide to use the run command:  

 Create an IAM role for EC2-SSM: 

  1. Go to IAM Dashboard in AWS Console
    https://console.aws.amazon.com/iam/home?region=us-east-2  
    IAM Dashboard
  2. Click on Roles on the left pane and click Create role
    Create Role

  3. Choose the AWS Service (EC2) and click next permissions
    Create Role
  4. Choose AmazonSSMFullAccess and click on next
    Amazon SSMFullAccess
  5. Give a name for the role and Click Create role
    Create Role

Create Instances with the above roles attached:

  1. Go to EC2 Dashboard in AWS
  2. Click on Launch Instance, Choose the ubuntu AMI (ami-0b9064170e32bde34)
  3. In Instance type, choose T2.micro and click on next

    ubuntu AMI

  4. In Instance Configure, let the instance count by 1.In the IAM role, choose the role you created in the previous task
    IAM role
  5. Keep default values for storage and move to the next stage.
  6. Add tags to the Instance
    Adding Tags
  7. Review and Create the instance.

Create a VPC Endpoint: 

  1. Go to VPC Console,
  2. Choose Endpoints towards the left pane
    Endpoints
  3. Click on Create Endpoint
    Creating Endpoint
  4. Choose Service Category: AWS Service and select the Servicecom.a
    mazonaws.us-east-2.ssm

    AWS Services
    Service Category
  5. Choose the VPC, subnet to which you want to create an endpoint
  6. Click on create Endpoint
    AWS Service
    Create Endpoint

Create a run command and execute the command:

  1. Go to System manager console
  2. Towards the left pane, choose the Run Command Service
    Run Command
  3. Click on the Run command
    Run Command
  4. Choose the Command Document that is compatible with the type of end servers ( Linux / windows)In this demo,  We are using Linux servers, so I choose AWS-ConfigureAWSPackage
    AWS-Configure-AWSPackage

  5. Scroll down, in command parameters,
    a. Action, (install)
    b. Installation type:
    c. Name: Provide the valid Package name ( eg: AmazonCloudWatchAgent, AwsEnaNetworkDriver)
    AWS-Configure AWS PAckage
  6. Targets: there are 3 ways you can identify the end servers:
    a. By specifying tags
    b. Manually choosing
    c. Choosing the resource GroupClick on Choose instance manually
    Choose instance manually
  7. In the output options, Uncheck, enable S3 output
    S3 bucket
  8. Click on the run command.
    Run command
    You will notice the execution of the command.Execution of command
    Run Command
    Run Command
    Run command
  9. Verify:

    1
    2
    sudo systemctl start amazon-cloudwatch-agent
    sudo systemctl status amazon-cloudwatch-agent

Hope this blog has shed light on the uses of ‘run command’, and how it can be used to manage and maintain the servers. It can be used to perform patch updates to the servers without SSH into the machine easily and securely.
To learn more about managing infrastructure on AWS, then here is a step-by-step guide for you.

Feel free to drop any queries and our team of experts will get back to you very soon.

Cheers!


14 Responses to “Running Commands Using AWS Systems Manager: A Step-by-Step Guide”

  1. Anusha Shanbhag Anusha Shanbhag May 21, 2021

    Very inofrmative

    Reply
    • Shyla Shyla May 28, 2021

      Thanks

      Reply
  2. Shravya May 22, 2021

    Very informative with detailed explanation

    Reply
  3. Debbie Pais May 22, 2021

    Informative and well structured post!

    Reply
  4. Munwar May 22, 2021

    Very useful and interesting blog👍

    Reply
  5. Anees A A May 22, 2021

    Informative

    Reply
    • Seeli May 27, 2021

      Very edifying

      Reply
  6. Gurjot Brar Gurjot Brar May 27, 2021

    Very informative….

    Reply
  7. Sophia May 27, 2021

    It’s good and very informative and useful

    Reply
  8. Seeli May 27, 2021

    Very edifying

    Reply
  9. Shailendra May 27, 2021

    Very nice

    Reply
  10. keerthish May 27, 2021

    very informative and easy understandable

    Reply
  11. Swasti Ray May 27, 2021

    Very well written and helpful content

    Reply
  12. Kamesh August 5, 2021

    How to automate and schedule this run command?

    Reply

Leave a Reply to Sophia

Click here to cancel reply.

Benefit from our new offering 'Azure Mastery Pass' – One pass to attend all our Microsoft Azure courses for 1 year & get trained from best of our Consultants and Microsoft Certified Trainer.



Register Your Interest Now! Please fill out below details & we will revert within 24 hours.

Thank you for your interest.
Oops something went wrong.

Follow us for latest articles

Popular Posts

  • Top Cloud Service Providers in 2021: AWS, Microsoft Azure and Google Cloud Platform
  • Tips to Crack AZ-900: Microsoft Azure Fundamentals Exams
  • Site-to-Site VPN connection between AWS & Azure
  • Sample Questions for Amazon Web Services Certified Solution Architect Certification (AWS Architect Certification) – Part I
  • Preparing for Azure 70-532 Exam: Developing Microsoft Azure Solutions

Recent Posts

  • Quantum Computing as a Service (QCaaS): Azure Quantum- Taking Baby Steps Towards Quantum Computing
  • Why DevOps is Important? A Comprehensive Picture
  • The Road to AWS DevOps Competency Partnership Program
  • AWS Media Services: Build a Scalable Media Platform in Cloud
  • Introducing AWS Network Firewall: Step-By-Step Guide To Provisioning AWS Network Firewall– Part 1

Recent Comments

  • Ismayil Siyad on Quantum Computing as a Service (QCaaS): Azure Quantum- Taking Baby Steps Towards Quantum Computing
  • Daliya.V.K on Quantum Computing as a Service (QCaaS): Azure Quantum- Taking Baby Steps Towards Quantum Computing
  • Ismayil Siyad on Quantum Computing as a Service (QCaaS): Azure Quantum- Taking Baby Steps Towards Quantum Computing
  • Anush on Quantum Computing as a Service (QCaaS): Azure Quantum- Taking Baby Steps Towards Quantum Computing
  • Ismayil Siyad on Quantum Computing as a Service (QCaaS): Azure Quantum- Taking Baby Steps Towards Quantum Computing

Archives

Categories

  • AI
  • AI/ML
  • Analysis
  • Analytics
  • API
  • Apps Development
  • Artificial Intelligence
  • Artificial Intelligence and Machine Learning
  • Automation
  • AWS
  • AWS Amplify
  • AWS EKS
  • AWS PinPoint
  • AWS Thunderbird
  • AWS Transit Gateway
  • Azure
  • Azure Machine Learning
  • Big Data
  • Blockchain
  • Certification BootCamp
  • Cloud Computing
  • Cloud Data Science
  • Cloud Migration
  • Cloud security
  • Comparision
  • Cryptocurrency
  • Cybersecurity
  • Data Analytics
  • DevOps
  • Docker
  • Google Cloud (GCP)
  • Hadoop
  • Identity Access and Management
  • Internet of Things (IoT)
  • Interviews
  • Kubernetes
  • Machine Learning
  • Microsoft 365
  • Microsoft Azure
  • ML
  • MongoDB
  • News
  • NoSQL
  • OpenStack
  • Power Platforms
  • Private Cloud
  • Project Management
  • Tutorials
  • Uncategorized
  • vCloud Air
  • Videos
  • Windows

Like us for latest articles

© 2022 CloudThat Technologies. All rights reserved.