SAGARFIVE

Projects

3.2 Create EC2 Instance with S3ReadOnly IAM Role


Step 1 – Open EC2 Service :

Step 2 – Launch instance :

Step 3 – Launch an instance :

Sl.NoStage/stepDetails/configurations
(i)NameP1-ExploreWorld_DeploymentGroup_VM-EC2-Server
(ii)Application and OS ImagesAmazon Linux 2 AMI (HVM) – Kernel 5.10
(iii)Instance typet2.micro
(iii)Key pair (login)New β†’ Name , type=RSA , Format=.pem
(iv)Network settingsAllow SSH traffic from AnywhereAllow HTTP traffic from the internet
(v)Advanced detailsUser data : copy paste below data
πŸ“#!/bin/bashsudo yum -y updatesudo yum -y install rubysudo yum -y install wgetcd /home/ec2-userwget https://aws-codedeploy-us-east-1.s3.amazonaws.com/latest/installsudo chmod +x ./installsudo ./install auto

(i) Name : P1-ExploreWorld_DeploymentGroup_VM-EC2-Server or your wish

(ii) Instance type : t2.micro (1GB RAM – 1 Core CPU – Free Tier eligible)

(iii) Key pair : It’s a SSH key (It’s used to enable password less logins)

  • New β†’ Name ,
  • Keypair type=RSA ,
  • Private key file Format=.pem

(iv) Network settings : Using Default settings,

Allow SSH traffic from Anywhere

Allow HTTP traffic from the internet

(v) Advanced settings :  Scroll down and add userdata for CodeDeploy Agent installation

CodeDeploy Agent needs to be installed on the machine to handle the CodeDeploy operations

Copy and paste the Userdata (Bootstrap) script from below

πŸ“#!/bin/bashsudo yum -y updatesudo yum -y install rubysudo yum -y install wgetcd /home/ec2-userwget https://aws-codedeploy-us-east-1.s3.amazonaws.com/latest/installsudo chmod +x ./installsudo ./install auto

Once after clicking on Launch Instance , It will show the Success dialogue , click on blue color instance id in dialogue box

On Instances page , we can see EC2 instance showing Running

Next we need to attach S3ReadonlyAccess Role from grabbing web server files from it

Share

Facebook
LinkedIn
WhatsApp
Pinterest
Telegram
Email

Share