WIP script to create instances of the command line

pull/16/head
alok 7 years ago
parent cc8a6d805c
commit a5b100dfd3
  1. 7
      aws-code/create_instances.sh
  2. 10
      aws-code/user-data.sh

@ -0,0 +1,7 @@
# security_group_name=$1
# security_group_description=$2
aws ec2 create-security-group --group-name mcDG --description "mcdg"
aws ec2 authorize-security-group-ingress --group-name MySecurityGroup --protocol tcp --port all --cidr 0.0.0.0/0
aws ec2 run-instances --image-id ami-a9d09ed1 --count 1 --instance-type t2.micro --key-name main --security-group-ids mcDG \
--user-data user-data.sh --iam-instance-profile Name=CodeDeployDemo-EC2-Instance-Profile

@ -0,0 +1,10 @@
#!/bin/bash -x
REGION=$(curl 169.254.169.254/latest/meta-data/placement/availability-zone/ | sed 's/[a-z]$//')
yum update -y
yum install ruby wget -y
cd /home/ec2-user
wget https://aws-codedeploy-$REGION.s3.amazonaws.com/latest/install
chmod +x ./install
./install auto
mkdir projects
mkdir projects/src
Loading…
Cancel
Save