Installing PDO in amazon AWS - amazon-web-services

im trying to install simple app in Amazon AWS. Since im really new to servers i used Elastic Beanstalk.
Everythink ok, but when i run my app i get an error: PDO error: could not find driver.
I tried mysqli_ping the connection and got boolean true, so this is OK.
I checked for help, but all i found is here:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_PHP.rds.html
2.If you plan to use PDO, install the PDO drivers. For more information, go to http://www.php.net/manual/pdo.installation.php.
But i really don't know what to do with this information. Any help?

so, its quite a procedure, first you have to get ssh access to your instance:
1. Generate key value for you instance & download it in pem format.
go to: https://console.aws.amazon.com/ec2/v2/home?region=eu-west-1#Instances (change for your region)
click Key Pairs, Create Key pairs and create your new key par and download it to you comp.
assosiate your instance with the key, go to elastic beanstalk, select you application, select configuration, instances and select your new key from drop-down of EC2 key pair.
2. download putty for windows (installer) & install it: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
3. Transform key to .pkk format using PuTTYgen:
http://www.techrepublic.com/blog/the-enterprise-cloud/connect-to-amazon-ec2-with-a-private-key-using-putty-and-pageant/?tag=nl.e011#.
4. Setup putty to use key: http://docs.aws.amazon.com/gettingstarted/latest/wah-linux/getting-started-deploy-app-connect.html
5. run putty and find you instance public dns and add ec2-user in front of it, so it looks like this: ec2-user#ec2-54-76-47-0.eu-west-1.compute.amazonaws.com
Then is as simple as: yum install php-pdo

Related

botocore.exceptions.ClientError (InvalidAccessKeyId)

I am new to docker and in our dev env, we have S3 access key id and AWS secret access key. We are using the digital ocean spaces to offload our dev env static files. We need to run the collect static command manually to update the media and static files. The whole process was working fine for the last couple of months but I am recently facing this error. After some research, I updated the Acess key id and AWS secret access key but this error remains the same. Can anyone please help me with this issue?
enter image description here

APEX_ADMINISTRATOR_ROLE in AWS RDS Oracle Instance

I am trying to install APEX on my AWS Oracle 12 RDS Instance. In order to achieve this, I am following these instructions : http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.Oracle.Options.APEX.HTML
However, I got stucked in step 7:
Step 7:
You must set a password for the APEX admin user. To do this, use
SQL*Plus to connect to your DB instance as the master user, and then
issue the following commands:
grant APEX_ADMINISTRATOR_ROLE to master;
#/home/apexuser/apex/apxchpwd.sql
Replace master with your master user name. When the apxchpwd.sql
script prompts you, type a new admin password
When I log into my my RDS Instance with my master user and execute this:
grant APEX_ADMINISTRATOR_ROLE to [mymasteruser];
I received this error:
ERROR at line 1:
ORA-01924: role 'APEX_ADMINISTRATOR_ROLE' not granted or does not exist
Can you please help me to solve this?
Edit 12/09/2017.
Using this post/answer:
https://serverfault.com/questions/276541/how-do-you-recover-you-rds-master-user-username
I understand my master user is shown in the following image. As I know, in RDS instance i have no access to sys or system user, so this is the only user i can use.
Many thanks
Edit 20/09/2017.
I applied Alex solution, and it works!!. However, some issues to comment:
The tutorial was changed, in fact the url changed, now is
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.Oracle.Options.APEX.html (the last "html" was in uppercase before)
but is not reliable now, there are some points that should be fixed, e.g. it says now that RDS support Oracle APEX version 5.1.2, i tried with this versión and I got this error:
Also, some directories dont match with the previos step ....
So, I used the versión that the tutorial originally says : Oracle APEX version 4.2.6.v1
I had to execute both statements :
EXEC rdsadmin.rdsadmin_util.grant_apex_admin_role;
grant APEX_ADMINISTRATOR_ROLE to [master];
Then i could execute the apxchpwd.sql script successfully!!.
But, unfortunately, when I accessed to my apex home page and tried to create a new workspace "ws_prueba", I receive this error (Im trying to create it with my apex admin user):
Any ideas?
Use
EXEC rdsadmin.rdsadmin_util.grant_apex_admin_role;
instead. I have a case open on this with AWS and just asked them to update the documentation page.

Lsyncd between two EC2 instances

I have two EC2 instances and i am trying to sync a directory between the two of them.
I have set up the lsyncd service on one of the instances and was able to sync a directory to different directory on the same instance.
Now i am trying to sync the same directory with the second instance and it is not working.
The reason it is not working is that I am not able to put the key that was generated on the first instance using ssh-keygen -t rsa on the second instance in order to allow them access each other.
I have tried sudo ssh-copy-id -i /path/to/key ec2-user#ip-of-second-instance but it did not work.
I have also tried to manually copy the public part from the key.pub file of the first instance to the ~/.ssh/authorized_keys of the second instance but it did not work either.
That is my lsynd configuration settings:
settings = {
insist = true,
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd.status"}
sync {
default.rsyncssh,
source = "/home/ec2-user/IntSrv/Sync",
host = "second-instance-ip",
target = "/home/ec2-user/GenSrv/Sync",
}
What am i doing wrong? How can i fix that issue?
Any help would be appreciated. Thank you.
You might want to start again with the keys.
You should really be generating your own keys for each user. Then, for each user you want to grant access to the instance, add their key to the .ssh/authorized_keys file, either for the ec2-user or preferably create a user account for them first and add it to their authorized_keys file.
The keys generated by Amazon EC2 should be used to gain initial access to your instances. Then, proper security practice is to remove that key and add your own keys. This way, you have each person accessing via their own keypair, which can be removed if you wish to rescind access.
While I'm not familiar with lsyncd, I suspect that if you get ssh working, then lsyncd will probably work fine, too.
So, quick summary:
Generate a key for YOU using ssh-keygen
Connect to the desired instances, and add your public keypair to authorized_keys within the desired user home directory
Use those keys instead of the ones generated by Amazon EC2

copy key pair to amazon

I have run into trouble
I have ec2 instance. I connected to it via ssh.
I wanted to set up POST hook for git.
And accidentally removed authorised_keys from /.ssh directory
My question is : if I am still connected to my aws instance can I copy myKey.pem to /.ssh directory ?
I want to omit instance restore process
Thank you in advance !))
If you can't find the public key that corresponds to your current .pem file, just generate a new key pair, and add that public key to your ~/.ssh/authorized_keys file! You could use AWS to generate the new key pair, or check out these popular instructions from GitHub: help.github.com/articles/generating-ssh-keys.

ssh through python onto amazon ec2

I have two databases one on my local machine and one on my amazon ec2 instance.Now what I
do is I run a python program on my local machine which makes changes to the databse on my local machine.I want these changes to be reflected onto the database on amazon ec2 instance,
periodically.I want to do this in python.A script that logs onto the amazon server establishes a connection with the database there and makes the changes.
I came across some modules like pexcept,fabric and paramiko.But I am struggling with the
key authentication.
The way I ssh from my terminal is ssh -i my_rsa_file.pem username#ip_address.There is no password.How do I go about this ??
Also I want to know whether simply using Popen in subprocess to execute the login command work ?
The Boto EC2 documentation here describes the EC2 instance object, of which "key_pair" is an attribute. Look about 3/4 of the way down, under "boto.ec2.instance".
http://boto.readthedocs.org/en/latest/ref/ec2.html
So, e.g., you could run some instances as follows, and then store the first instance as "inst":
reservation = conn.run_instances(...)
inst = reservation.instances[0]
To retrieve your key-pair name as a unicode string, just use:
kp_name = inst.key_name
You can then retrieve the corresponding Boto object using get_key_pair:
kp_obj = conn.get_key_pair(kp_name)
Of course, this is a silly example, since I would have needed my key pair name to run_instances in the first place. May you find a more fruitful application!