Start Preparation Smartly

We have the collection to start prepartion smartly.

Start Assessment

Project: Deploy Scalable VPC Architecture on AWS cloud

  Edwiki Trainings

20 Followers

Pre-Deployment


Below are the Pre-Deployment steps covered here

  1. AWS CLI
  2. Install Apache Web Server
  3. Install Git
  4. CloudWatch Agent installation
  5. AWS logs configuration
  6. Push custom memory metrics to Cloud Watch
  7. AWS SSM Agent
  8. Creating Golden AMI


  1. AWS CLI

AWS cli comes pre-installed when we use AWS AMI while launching the instance, to validate the version installed we can use # aws - -version

 

  1. Install Apache Web Server

To install Apache webserver on Amazon Linux use command # yum install -y httpd

# systemctl enable httpd

 

  1. Install Git

To install git on Amazon Linux use command 

# yum install git -y

# git –version


# git clone https://bitbucket.org/dptrealtime/html-web-app.git /var/www/html/

 

  1. CloudWatch Agent

To install CloudWatch Agent on Amazon Linux use command # sudo yum install amazon-cloudwatch-agent

 

 


 

  1. AWS logs

# yum install awslogs -y

# vi /etc/awslogs/awscli.conf 

edit the region based on your region

 


# vi /etc/awslogs/awslogs.conf

Go to the bottom and change the log group name


#sudo service awslogsd start

 


  1. Push custom memory metrics to CloudWatch

Reference Collect metrics and logs from Amazon EC2 instances and on-premises servers with the CloudWatch agent - Amazon CloudWatch

 

  • Create an IAM role
    1. Click on Role and then create role

 

 

 


  1. Click AWS Service and EC2 under Use case then click next

 

  1. Choose CloudWatchFullAccess and AmazonEC2RoleforSSM then click next and create the role


  1. Choose your instance à Actions à Security à Modify IAM role

Attach the IAM role which has been created in previous step and update the IAM role


  • Create cloudwatch agent config file and paste below  json
    1. vim /opt/aws/amazon-cloudwatch-agent/bin/config.json

{

   "metrics":{

      "metrics_collected":{

         "mem":{

            "measurement":[

               "mem_used_percent"

            ],

             "metrics_collection_interval":60

         }

      },

      "append_dimensions": {

        "InstanceId": "${aws:InstanceId}"

      }

   }

}

 

  • Start CloudWatch Agent
    1. # sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json -s
    2. # sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a status

 


  • CloudWatch à All Metrics à Metrics à Custom Namespaces à CWAgent à InstanceId


 

  • Choose your instance and left click on mem_used_percentage and choose “Graph this metric only”


 

 

 

  1. AWS SSM Agent
  • Check the state for SSM Agent
    1. # systemctl status amazon-ssm-agent 

 

  • if is in stopped state you can use below
    1. # systemctl start amazon-ssm-agent
    2. # sudo systemctl enable amazon-ssm-agent

Note: If still you are not able to connect to ec2 via Session Manager use below command to restart the SSM Agent

# systemctl restart amazon-ssm-agent

 

  1. Creating Golden AMI
  • Select you EC2 instance à instance state à stop
  • Select you EC2 instance à Actions à image and templates à Create image
    1. Enter name and description as per your understanding and need


  1. You can monitor the status from EC2 à AMIs


 


Previous Next


profilepic.png
ANDHAVARAPU RESHMA 4 months ago

Can you post the problem statement, abstract and 

literature survey of this project

Powered by Froala Editor


profilepic.png
ANDHAVARAPU RESHMA 4 months ago

Can you post the problem statement, abstract and 

literature survey of this project

Powered by Froala Editor