Using IAM Role to allow access to MySQL database on RDS - mysql

I have an IAM Role, myRole, for my project. I have an RDS server with a MySQL instance on it. The MySQL instance requires a username and password, however I don't want to pass these in as plaintext via command line, nor store them somewhere for retrieval later.
What I would like to do is somehow use the IAM Role as authentication in order to be able to perform backups, etc.
Is this possible?

It is now possible for MySQL or Amazon Aurora:
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html

This isn't possible. IAM is for AWS resources. As related to RDS you would use IAM to give someone permission to create or modify an RDS server. The MySQL database engine doesn't know that it is running on AWS and doesn't know anything about IAM roles, so it can't use that for user authentication. You have to stick with username/passwords for authentication to the database.
Update 12/13/2017: You can now use IAM authentication for RDS MySQL and Aurora.

See this gist with code example and notes on authenticating MySQL via PHP to Amazon Aurora using IAM:
https://gist.github.com/sators/38dbe25f655f1c783cb2c49e9873d58a

Related

Why is my MySQL Database on AWS not accessible?

I cannot reach my MySQL Database instance I created on AWS.
What I tried was to set the public access of the Database to "Publicly accessible" here:
Also I tried to set Inbound/Outbound rules for the MySQL port here:
Honestly I think using "All" ports would include 3306 too. Anyways, I tried it this way because yet it didn't work. I cannot connect to the database via MySQL Workbench, nor can I use a ping request on the given endpoint.
I would be glad if someone here has an idea what I could try else.
This will not work if you have deployed it in a private subnet which has no internet access.
Another possibility is that there is ACLs that is stopping the traffic. Security group only touch the RDS instance, the ACLs control traffic in the entire subnet.
Here is a dev AWS tutorial that creates a web application that stores data in MySQL running on the cloud. It will show you how to setup the database and the inbound rules. Once you do, you can store data or query data from MySQL. Likewise, you can use MySQL Workbench to interact with MySQL on the cloud.
AWS RDS Tutorial

AWS - How can I setup RDS?

I am trying to setup RDS on my AWS account. I created the RDS instance, But I am not able to access the database interface. I am trying to access it using putty, But it is saying - "Command not found".
Please clarify whether I am missing something.
Thanks
You didn't mention the RDS Database engine you are using, but here are some general tips.
Use a local database client (such as mysql workbench for mysql)
Make sure your RDS security group allows your local ip address to access the RDS instance on the correct port.
If you give more information about your setup we'll be able to help you more.

need to connect my same apps with one database

i have 3 servers for three applications on aws ec2 using MySql database,
now each of the application is having amember that is client subscription app,
it connects with sql databse that is created in each instance
so in this way every amamber app is having diffrent database in each server,
now we are working with a device ROKU we need to pass the XML attributes from amember to it
to varify the user so he can watch online streaming tv.
the objective
now i need to make one database that will be connected with each server using amember
so each server access one database .
Options
my options are aws RDS ,dynamoDb
Now can anyone put me in the right direction, for that.
in simple Words
need to connect my multiple apps (same app) with one database
HELLLLP
If you need to connect to a mysql database, DynamoDB is not the answer. It isn't a mysql database.
RDS is a mysql database. It connects like any other mysql database. You haven't mentioned what language[s] you are using, however. Googling "connect to mysql with [language]" should help.
I think it would be best to stick with relational databases such as MySQL.
Amazon RDS is a managed MySQL solution, but you don't have to use it for your needs.
You can use one of your EC2 instances or a new EC2 instance as the central DB and connect all the other servers to it for quires. There are pros and cons for choosing RDS over your own SQL server. If you have any questions there, feel free to edit your question and add them.
EDIT according to comment
In order to connect your application with the local MySQL. Your are probably using a connection string that points to either "localhost" or "127.0.0.1"... That is the IP of your local machine. You will have to change it to the remote IP of the machine where the DB is stored remotely.

How does one see what data is stored in the RDS database?

Running our app on Amazon RDS. How does one review / inspect data in the database? For example, how can I get a list of articles?
My app is running on Ruby on Rails and on Heroku. One method I thought of, is by running the Heroku console command.
Is there a better way to see what data is stored in the RDS database?
I use MySQL Workbench to view data, run queries, and so on. It connects right up to the Amazon RDS MySQL instance using the regular MySQL settings.
Updated:
Be sure to add the ip address of the computer for which you're connecting to the RDS instance to the access list in RDS. IIRC, by default RDS instances will only accept connections from within AWS.
I was using SequelPro but they don't support ssl. Amazon RDS says something to the effect of having to use SSH to connect your EC2 to your RDS.
This is essentially what was done in the following tutorial which uses MySQL Workbench: http://thoughtsandideas.wordpress.com/2012/05/17/monitoring-and-managing-amazon-rds-databases-using-mysql-workbench/
I had also been using SequelPro before but this tutorial is very clear and I was up and running on MySQL Workbench in just a few minutes.

How to 'switch' from MySQL to Amazon RDS with minimal application impact?

Amazon officially states: "Amazon RDS gives you access to the full capabilities of a familiar MySQL database. This means the code, applications, and tools you already use today with your existing MySQL databases work seamlessly with Amazon RDS."
I don't get this. Amazon RDS is accessible via web services and there a client libraries (like the one for .Net).
So if I have an existing .Net application that uses a DAL which in turn queries MySQL, how can I make the same DAL talk to the Amazon RDS (via the web services). Or am I missing something here?
Amazon RDS is pure MySQL, accessible by your app the same way as any other MySQL database; the web services interface to RDS is purely for creation, deletion, and modification of the DB instances, not the DB data. From their FAQ:
Q: How do I access my running DB
Instance?
Once your DB Instance is available,
you can retrieve its
endpoint via the DescribeDBInstance
API. Using this endpoint you can
construct the connection string
required to connect directly with your
DB Instance using your favorite
database tool or programming language.
In order to allow network requests to
your running DB Instance, you will
need to authorize access. For a
detailed explanation of how to
construct your connection string and
get started, please refer to our
Getting Started Guide.
This is the part of the Getting Started Guide you need -- it explains how to get the hostname of your new instance so you can connect to it, authorize the instance for access from the client, and then connect using the MySQL command-line client (as an example):
$ rds-describe-db-instances --headers
$ rds-authorize-db-security-group-ingress default --cidr-ip 192.0.2.0/30 --headers
$ mysql -h myinstance.crwjauxgijdf.us-east-1.rds.amazonaws.com -P 3306 -u mymasteruser -p
Amazon RDS is just a normal server with normal MySQL access. There's only the webservice that handles instance creation etc., but everything mysql related is still the same.