Taking automatic snapshots of ec2 volumes is currently not as ‘automatic’ as the case with an RDS instance in which we can fully automate it.
However with AWS Ops Automator and CloudFormation, we can come up with a solution to automate the creation / deletion of snapshots.
1.1) First, launch CloudFormation and create a new stack :
1.2) After clicking on create new stack, select the option
Give the URL as : https://s3.amazonaws.com/solutions-reference/ops-automator/latest/ops-automator.template
1.3) Give the stack a name in the next page and specify the paramters below it. Dont forget to give the
1.4) Select the next page, leave the options page as default and click next.
Review the options and tick on
and go ahead with create.
Give 5-10 mins for the stack creation to be completed.
Once complete, you will find
Step 2) Next step would be to launch the task template ( for creating snaps)
To do that,
2.1) Open the s3 console in the account in which the above ops automator stack was created
2.2) There would be 2 buckets created, open the one with the keyword configuration, it would be something like opsworks-configuration-xxx. Open it and click on the configuration folder. Now, select the applicable template. First, we would take a template to create the snapshot every ‘x’ hours.
2.3) So, look for the template Ec2CreateSnapshot.template and copy the Link associated with the file ( template )
2.4) Now, go back to CloudFormation and create another stack.
2.5) In the option,
2.6) Give the stack name, something like createsnap which would help to distinguish from other stacks.
2.7) Fill in the paramters like task description etc, The time interval would be a cron time. To run everyday at 3 am, it would be : 0 3 */1 * *
2.8) Give the paramters like, Regions, Timezone.
2.9) Take a note about ‘‘
What you set here, would go as the tag which we will add to our ec2-instances.
So, set something like snapshot-time=3
would mean ‘snapshot-time’ is the tag and its value is 3.
Also, note the Snapshot volume options.
2.10) Dont forget to add “
I added something like : volume-source=auto
So my config looks like :
Go ahead and press Next.
Press Next in the options page without modifying anything,
Review and press create and wait for the stack to be created.
Step 3 ) Next, we would be creating the stack to remove the older snapshots.
3.1) Go to the s3 console as we did with the previous stack, select the configuration folder, this time copy the link of the template –
3.2) Go to ClouldFormation and select Create new stack, in the select template,
3.3) Give the stack a name and go through the parameters.
3.4) As with the previous stack, give the task interval in cron format.
3.5) The tag filter value here would be the tags that will look in the snapshots to be deleted. In the previous stack, we set the tags for the snapshots to be volume-source=auto ( step 2.10)
So give that value here as the tag filter.
3.6) You can either select
My config looks something like this :
Remember to put 0 in retention days option if you are using retension count and vice-versa.
So, with that the Cloudformation and ops automator are set up. Next is to tag the ec2 which needs the snapshot to be taken
What we had set during the snapshot creation stack was snapshot-time=3 ( step 2.9 )
So, go to the EC2 console – Instances – Select the instance, Actions -> Instance settings – Add/Edit tags.
Add the key – snapshot-time and value as 3.
This should get the snapshot creation at the time we specify and delete it in the way we specify either looking at the retention count / days.
The Amazon RDS ( AWS RDS ) – Managed relational database service from aws is a real blessing these days. Since its managed by aws, you don’t have to worry about the patching / administration / backups / restore aspects of it. All you need to do is upload the codes into it and make sure the connection between ec2 ( web-servers in this case ) and RDS is all good.
But, what if you want to manage the tables / dbs of the rds ? There is no way in which you can login into it directly and execute any codes.
You can make use of phpMyAdmin to login to the rds and manage it.
1) Install phpMyAdmin in the ec2-server ( Based on the linux distro it varies ) On a centos release, it comes with the EPEL Repository.
2) Once installed, open the conf file at /etc/httpd/conf.d/phpMyAdmin.conf
You will find parameters which specify Require ip and Allow from which would be default to 127.0.0.1
3) Find your local public IP and replace the localhost entires with the public IP.
4) Restart the httpd service and make sure you can access phpMyAdmin at http://serverip/phpmyadmin.
If Step 3 is not done properly, you will get a 403 Forbidden error.
With this, the installations steps are complete, however, logging now to phpMyAdmin would give you only the option to manage the dbs on the local server now. To have the choice to connect to the RDS do the following :
1) Open the File – /etc/phpMyAdmin/config.inc.php ( on centos this would be the path )
Sign in using your Mi account and give valid reasons on why you want to unlock the bootloader. Just be honest here. I mentioned the fact about the bugs in the upgrade and hence i wanted to try custom roms. I had to wait for 3 days before my application was accepted. You will receive an SMS to your mobile number confirming that you have received the permission to unlock the BL.
## Try from Alternate PC for unlocking ! ( Tried that too, nothing works)
After getting fedup, i decided to contact the MI live Chat support to know what their feedback was. I had a chat with three different agents and three of them had 3 different solutions 😀
# Miss Shankunthala ( names have been changed ) told me a pretty funny reason. Mi took away the option to unlock BL for Indian customers, citing security reasons 😛 So for indians, its kind of banned and if i really need to unlock, i would need to visit the local service center. On asking whats special at a service center, she replied, they have a special USB cable to unlock this. I almost fainted ( I have the chat saved with me 🙂
# The other two agents told me , to reapply for permission. But if you once applied for permission, you will not even see an option to request again. These guys were asking me to do something which isn’t there in the first place.
By this time, i felt insane for the replies i got. I flashed the Stable ROM back and was waiting to see how to get this done.
I decided to wait for few days before trying again. Waited for 3 days and gave it a try and hurraaaaay !! no error this time at 50%, it got completed. Really not sure on what is the real issue, the support at Mi isn’t ready to disclose this yet. May be I had to wait 3 days for my data to get propagated at Mi unlock servers 😛
We are talking about CentOS 4 and CurLSSL here. We may have some legacy users facing this issue in enabling CurLSSL.
This was the error encountered :
======= vtls/openssl.c: In function `Curl_ossl_init’: make: *** [vtls/libcurl_la-openssl.lo] Error 1 make: Leaving directory `/home/cpeasyapache/src/curl-7/lib’ make: Leaving directory `/home/cpeasyapache/src/curl-7/lib’ dryrun test ‘Find Curl SSL path for PHP 5’ did not return true !! Dry run failed for ‘Cpanel::Easy::PHP5::CurlSSL’ skipping option !! — End opt ‘CurlSSL’ — checking for cURL support… no checking if we should use cURL for url streams… no vtls/openssl.c:753: error: `CONF_MFLAGS_DEFAULT_SECTION’ undeclared (first use in this function)
When building curlssl in /home/cpeasyapache/src/curl-7, this error can be corrected by adding the following :
From PHP 7.0.0, it supports 64-bit architecture. To find if your PHP is 64- bit or not, open PHP info window and search for Architecture.
Also it will be Thread safe OR Non-Thread safe. We can use phpinfo for this one too. Check for thread safety in phpinfo window, If thread safety is disabled then your PHP is Non-Thread safe.
Once you determine the correct PHP Type, download the appropriate dll files from the above mentioned link. Copy and paste it to PHP extension folder. ( In default – C:\Programfiles OR Program Files (x86) \PHP\v7.0\ext )
Once completed, restart your web server.
After restarting, open IIS manager and look for PHP Manager in it. Double click on PHP Manager and open it. Then in right pan you can see a new window called PHP Setup.
If you are opening PHP manager for the first time, then you will see a message. ( red circlein the following image ) . Click on that and enable all.
Then click on ‘Enable OR Disable Extension’ tab and find for php_imagick.dll . Click on it then click Enable button in the right side panel to enable ImageMagic Extension.
Once enabled, restart IIS.
Once completed, open phpinfo page. You will be able to see that imagick module is added with php.