Created an ec-2 launch wordpress instance without key pair - wordpress

I'm pretty new to using amazon web services. I created a new launch instance using WordPress powered by Bitnami and made sure to create a key pair. The key pair I made shows up under the "Key Pair" category however it is not linked to my launch instance. How do I fix this without losing any of the content that's on my current Wordpress site? I want to access the instance through my terminal, however I need the key pair for authentication. Thank you!

It appears that your situation is:
Your EC2 instance with WordPress is operating fine
You did not associate a Keypair with the instance when it was first launched
Therefore you cannot login to the instance
To fix this, you will need to copy a keypair onto the boot volume. This can be done by accessing it via another computer (where you can login).
The basic steps are:
Launch another EC2 instance ("Debug instance")
Stop your WordPress instance
Detach the boot volume of the WordPress instance ("WordPress volume")
Attach the WordPress volume to the Debug instance
Login to the Debug instance, access the WordPress volume and copy a new keypair to /home/ec2-user/.ssh/authorized_keys (If you're not sure what to copy, copy the file from the same location in the Debug instance.)
Unmount and detach the WordPress volume from the Debug instance
Attach the WordPress volume to the WordPress Instance (as /dev/xvda)
Boot the WordPress volume and try to login
Terminate the Debug instance
A similar concept is documented here:
How to Recover an Unreachable Linux Instance
Lost my key with linux authorized_Keys. Now unable to login into the linux

Related

Enabling SSL/HTTPS on my Wordpress site running on AWS Cloud

I have issues with enabling SSL/HTTPS certificate for my web site.
Context:
I have installed Bitnami Wordpress on AWS.
Webserver (EC2 instance) is running in Frankfurt region
When I purchased a domain name from AWS, I ended up automatically in "Global" region in which Hosted Zone was automatically created.
I have created elastic IP and added A entry into DNS with elastic IP
the entries (after several attempts to make this work) in DND (route 53) are: 2 A records where one points to my-domain-name.com and other to www.my-domain-name.com, 1 MX, 1 NS, 1 SOA, 4 CNAME, 3 TXT entries
Tried with following approaches
With Certificate Manager (Frankfurt zone) I have requested a certificate and created distribution list -> did not work
Tried also to connect with my Windows PC using ssh and pem file (following this tutorial https://www.youtube.com/watch?v=q2AdWoPNios) -> connection did not work after installing Cygwin and making permission changes. Error messages "Permissions for key-pair.pem are too open..." or "Permission denied (public key".
Now, all this aside... is it really so damn hard to add a simple SSL/HTTPS to a website?
Does a person doing this need to have 3 PhDs from MIT? If I registered everything over AWS why can't I simply enable this option? Instead I am jumping from one tutorial to another and from wanting to add this SIMPLE functionality I ended up going through tutorials about changing Windows permissions on a file, installing and using Cygwin, learning how to work with it, researching how to change the inheritance of a file etc etc etc.
I just want to add SSL / HTTPS to my site and work on a site, not learn everything there is to learn about Cloud, Windows and Cygwin...
Can anyone please offer a simple, step-by-step solution? Tx!

Is it possible to access via ssh a one click app from the Google Cloud Platform marketplace?

I just recently installed a one click application from the Google Cloud Platform. I installed WordPress as a VM instance , but when I try to access my VM instance via ssh i see that its empty and it doesn't contain any WordPress files. Is there a way to access the WordPress files either via FTP or even better ssh?
One click deployments should come with everything you need “out of the box”.
You can visit your Deployment Manager and click on the Word Press resource to view login options and choose SSH or login to the Word Press admin console from there.
Accessing files through SCP can be done through the GCloud command line as well as another alternative.

Why am I getting a redirection loop from PHP built-in web server on AWS Cloud9?

This is my first attempt to migrate a project from Cloud9 to AWS Cloud9 since the clock is ticking.
I have created a brand new environment on AWS Cloud9, which is supposed to work out of the box. I've uploaded WordPress files and database, replaced URLs with my environment's preview URL (https://*.vfs.cloud9.eu-west-1.amazonaws.com), then ran the build with a PHP (built-in web server) runner.
Usually, that's all that is needed to migrate a WordPress website but this time I am stuck in a redirection loop whenever I try to preview the site.
My findings so far are that it's all down to forced SSL by AWS Cloud9. They specifically said they won't allow for any environment to work over a non-secure connection.
When I set the home_url in the options table to "http://...", then the loop breaks and the site appears. Of course, assets don't load because of the insecure connection. However, when I switch back to https in the home_url value, I am back in the loop...
No matter what I put in .htaccess, it doesn't help. I can't even find where to config Apache as the default /etc/httpd/conf.d/httpd.conf refers to /var/www directory, where as AWS C9's default workspace dir is /home/ec2-user/environment.
Below is a screenshot of my console while it's stuck in the loop. It does numerous connection to itself (duh..) and finally terminates.

Local Drupal website connecting to a remote database

I'm new to Drupal. I want to run my Drupal website locally and connect directly to the remote database, but I can't seem to figure out how to do it. I have MAMP installed on the Mac and I have all the files in the htdocs folder. It looks like I just need to change the settings.php file to match my remote database, but I'm unsure what I need to change.
I guest you look at this drupal.org HowTo that step by step guides you through creating the database and what you need to change before running the Install program.
https://www.drupal.org/node/66187
Also check the comments on that thread.
Yes, you have to adjust your settings file (/sites/default.settings.php), database configuration. Watch out, usually there is a different ("external") host for accessing database from out of server. I think that it can be set per database user does it has privileges to access database from outer server or not. Maybe there's some special user for that.
There should not be any extra setup or configuration. Just make sure that
You are connected to the remote database (usually goes in sites/default/settings.php).
The database host allows remote connections.

Wordpress Dev Environment Migration

I've tried looking around for a guide on moving a wordpress site into a dev environment, but all of the guides I've seen have been about CREATING one, as opposed to my situation, where I need to move an existin site to a local VM to create a dev/testing environment.
I'm fairly well-versed on how to create a dev environment from a regular old website, but just about everything wordpress-related gets me confused somehow.
Where I am now:
I've created a CentOS 6.0 VM using VMware on a Windows 7 machine. I've installed PHP, Apache, MySQL, and FTP-Server, along with all of the required updates and such. I have disabled SELinux.
I've moved the contents of the var/www/html/ folder from the live (production) server over to the var/www/html/ folder on my VM (currently exists within /var/www/html/my-website/)
My current issue:
When I attempt to access localhost/my-website/ I'm getting "Error establishing a database connection". An attempt at localhost/my-website/wp-admin/ tells me that either the database server is down (do I have to start this separately?) or that the username and/or password information in wp-config.php is incorrect (this was all simply moved from one place to another).
Any assistance would be greatly appreciated.
Have you updated wp-config.php to include your localhost and database info for your local dev environment?
I bet wp-config.php is still pointing to your remote server DB which the MySQL DB wont allow for external connections
Also, make sure that the dev is using the same domain as the live version. On my windows machine, I do this by changing my hosts file. I'm sure there is something similar on your VM.
If I am unable to do this and I need the dev version to be under a different domain I would do the following.
Create mysqldump of live database
Edit the dump and replace
all occurrences of livedomain.com with devdomain.com (if you dont do
this at least check the wp_options table for the livedomain.com
occurences.
Change wp-config.php database settings.
I always ensure to use the same domain (controlled by local hosts file), and same db config in my dev environment as in my live environment.
If you've not changed the wp_options table for (option_name = siteurl or option_name = home), then chances are if you type in devdomain.com into your browser it will redirect to newdomain.com
Hope this helps
Blake
I know this was been answered but just to be perfectly clear:
on Centos6 you need to run httpd with php, and the mysql server. In the mysql server you have to import the database dump from the live website then you have to edit the config in wordpress to match the username and password on wordpress.
now when moved the db does not keep the username and password so I suggest you do this
commands to be run in shell:
service mysqld start
chkconfig mysqld on
that will take care of the db server running
then edit wp-config with username root and no password (I am pretty sure you have not added a password at mysql-server install)
post in here if you need further help.

Resources