Agenda
- Go to AWS console, and in instances create a new instance with an amazon linux AMI and all the default settings.
- Download the key pair generated and put in .ssh folder
- ssh in to the created instance:
ssh ec2-user@[instance public IP address] -i ~/.ssh/[your-key-name]
wget https://wordpress.org/latest.tar.gz
- download wordpress
sudo yum install mysql-server mysql php php-mysql mysql-devel mysql-libs httpd
- download dependencies
sudo tar xvfz latest.tar.gz -C /var/www/html/
- unzip in to this path
sudo chown
- can't remember this command to change owner to apache?
sudo service httpd start
- start web server (apache)
sudo service mysqld start
- start database
Then you should be able to see it live on public IP address [IP]/wordpress
- Create a launch config in AWS console
- Use amazon linux AMI
- Give it a name that you can find in the console, and in the user data section put your instructions (like above). Don't need to use sudo, as it runs these commands as the root user. For now, assign a public IP to every instance.
- In security groups, keep SSH and create an HTTP type with port 80.
- Assign your key pair to it.
- Select your launch config
- Name and add your subnets
- Just use defaults for the rest and confirm
Now you should be able to see your instances being spun up! You can ssh in to any of them to check that all of the stuff was installed properly.
- cd in to
/var/log
- cat
cloud-init-output.log
to view all of the output of your installed things. If there are issues you will have to create a copy of your launch config and assign your ASG to it. You can view instances under that ASG and terminate the old ones.
Put .pem in to .ssh folder & make sure to chmod 600 it (otherwise you won't be able to ssh in to it).