Error in AWS when trying to include puppet modules (Error: Could not find class apache2 for …)

Problem

You are trying to work with puppet modules in AWS, after installing puppet as a gem, but when you try to put the modules and manifests outside the main manifests/site.pp file you get an error similar to following:

Error: Could not find class apache2 for ip-xx-xx-xx-xx.eu-west-1.compute.internal on node ip-xx-xx-xx-xx.eu-west-1.compute.internal

Solution

Create a file for the puppet configuration in /etc/puppet/puppet.conf and add the paths to your own manifests and modules, like :

$aws sudo vi /etc/puppet/puppet.conf

and add your paths:

[main]
manifest = /home/ubuntu/puppet/manifests/site.pp
modulepath = /etc/puppet/modules:/usr/share/puppet/modules:/home/ubuntu/puppet/modules

Enabling MySQL server to be remotely accessible in Amazon EC2

Problem

You want to make your instance’s mysql server in Amazon available remotely, and you have set the firewall setting in your security group to allow access to port 3306, but you get the following error:

ERROR 2003 (HY000): Can't connect to MySQL server

Solution

You would need to edit your /etc/mysql/my.cnf file to allow access to the mysql server by changing the line:

bind_address 127.0.0.1

to

bind_address AMAZON_PRIVATE_IP

Make sure that the IP used is the private ip and not the Elastic IP.
You should be able to find that in your instance control panel.