DEV Community

Cover image for Using AWS CLI - Automating my post on - AWS SSM to Setup a LAMP Web Server & Hosting a Blog on it - Quick check ;)
Dinesh Rathee
Dinesh Rathee

Posted on • Edited on

1 1

Using AWS CLI - Automating my post on - AWS SSM to Setup a LAMP Web Server & Hosting a Blog on it - Quick check ;)

How To Execute Post using AWS CLI

We've followed AWS Console Steps for Installing a LAMP Web Server & then Hosting a WordPress Blog on Amazon Linux or Amazon Linux 2.

To check console steps , please click below link :
[+] https://dev.to/dineshrathee12/aws-systems-manager-automation-to-install-a-lamp-web-server-hosting-a-wordpress-blog-on-amazon-linux-or-amazon-linux-2-5d0d

Now, I will be explaining you on AWS CLI commands to achieve it in just simple steps:
<< Make sure you have AWS CLI setup and you've enough permissions to use SSM to execute these documents. >>
If you have admin privileges , it will be great !


Steps Using AWS CLI:



1). Running 1st Doc (“AWSDocs-InstallALAMPServer-AL2”)  :
# aws ssm start-automation-execution --document-name "AWSDocs-InstallALAMPServer-AL2" --document-version "\$DEFAULT" --region eu-west-1
{
    "AutomationExecutionId": "bd5xxxxxxxxxxxxxxxxxxxxxxx"
}

Checking the Automation progress / Status:
# aws ssm get-automation-execution --automation-execution-id "bd5xxxxxxxxxxxxxxxxxxx" --region eu-west-1 --output text --query "AutomationExecution.AutomationExecutionStatus"
InProgress

- Lets wait for few mins to get this completed and Can check the Status again:

# aws ssm get-automation-execution --automation-execution-id "bd56b3xxxxxxxxxxxxxxxxxxx" --region eu-west-1 --output text --query "AutomationExecution.AutomationExecutionStatus"
Success


- You can also check the CloudFormation Stack details/Status :

# aws cloudformation describe-stacks --stack-name "LAMPStack-AL2" --region eu-west-1


To define CloudFormation stack resources :

# aws cloudformation describe-stack-resources  --stack-name "LAMPStack-AL2" --region eu-west-1

We've confirmed the Execution Status - "Successfor first doc as well as CloudFormation stack status & resources, Now, we can proceed further for our next step..

2). Running  2nd Doc ( “AWSDocs-HostingAWordPressBlog-AL2”) :

# aws ssm start-automation-execution --document-name "AWSDocs-HostingAWordPressBlog-AL2" --document-version "\$DEFAULT" --region eu-west-1
{
    "AutomationExecutionId": "d61b49b7-xxxxxxxxxxxxxxxxx"
}


- Lets wait for few mins to get this completed and Can check the Status :

# aws ssm get-automation-execution --automation-execution-id "d61xxxxxxxxxxxxxxxxxxxxxx" --region eu-west-1 --output text --query "AutomationExecution.AutomationExecutionStatus"
Success


You can read more on AWS CLI references here :

[+] SSM AWS CLI References : https://docs.aws.amazon.com/cli/latest/reference/ssm/index.html#cli-aws-ssm

[+] CloudFormation AWS CLI References : https://docs.aws.amazon.com/cli/latest/reference/cloudformation/index.html#cli-aws-cloudformation

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay