AWS Classroom Series – 17/Apr/2020

Configure EC2 Instance

Preview Preview Preview


  1. Ensure the EC2 machine created has
    • some softwares (like git etc ) instance
    • services like apache/tableu etc are started
    • some files downloaded from internet
    • Solution:
      • for software installations we might create an ami (but ami requires storage cost)
      • Services can be automatically started if they are configured in that way in AMI otherwise change AMI to meet your needs
      • If we write some kind of startup script, which gets executed when the machine is created, then it will help.
  2. Lets install apache server on amazon linux instance
    • As shown in the image below create an instance by changing user-data Preview


  • A Startup script which gets launched when the vm is created and this approach is adopted by multiple clouds using a standard called as cloud-init.

  • In Cloud-init, user is expected to write a yaml file as mentioned over here

  • For overall documentation of cloud-init refer here

  • Userdata is stored in a service running in the ec2 machine on the ipaddress ‘’

    • To get latest userdata
    • To run user-data without restarting the machine
    sudo -i
    curl >
    sh ./
    • The logs of the user data are stored in /var/log/cloud-init-output.log
  • Instance-Metadata: Refer Here

  • Refer Here for simple cloud-init

  • simple example of cloud-init

repo_update: true
repo_upgrades: all

  - git
  - tree

  - [echo, 'helloworld']
  - [echo, 'helloworld1']


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin