First things first, my question is very similar to this one, but since I couldn't find a "Me too!" link, and it's been unanswered since Jan 1, I thought I would ask here. Please let me know if that was the wrong thing to do.
OK, so here is my problem. I have two AWS accounts, lets call them Prod and Audit. In Prod, I have many EC2 instances, all with their own specific IAM Roles already defined. In Audit, I have a number of S3 buckets.
What I need to be able to do is, using only IAM Roles, access the S3 buckets in the Audit account from specific machines, using specific IAM Roles, in the Prod account.
I've seen many answers talking about Group Policies, Resource Policies and having IAM users assume roles, etc, but as I said, I am using IAM Roles on EC2 instances, there are no groups, users, etc.
I don't want to have credentials anywhere on any of the instances, ala AWS Best Practices.
So is this possible? Is there some other secure way of doing this, without involving users or credentials? Any and all help greatly appreciated, thanks!
Note:
The application running on the Prod EC2 instances that I am attempting to allow access to the Audit S3 buckets is Logstash. I have confirmed the setup works when pushing logs to Prod S3 buckets, just not Audit ones. I have also tried using an S3 Bucket Policy with no success there either.
The S3 Bucket Policy I added is as follows:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CrossAccountPolicy",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<Prod Account ID>:root"
},
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::logstash.prod.logs",
"arn:aws:s3:::logstash.prod.logs/*"
]
}
]
}
The Inline Policy attached to the IAM Role for the Prod EC2 instance:
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::<Audit Account ID>:role/ProdLogstashPush"
}
}
The Policy attached to the IAM Role in the Audit account:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::logstash.prod.logs/*",
"arn:aws:s3:::logstash.prod.logs"
]
}
]
}
I am currently trying out fluentd/td-agent because I think it allows for sts:AssumeRole, which in theory would allow this setup to work.
Dean