Is it possible to enable both importing and exporting with an RDS PostgreSQL instance to an S3 bucket? I've been able to use the following pattern to enable one or the other with consistent success:
- rds-s3-io-role
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "rds.amazonaws.com"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"aws:SourceArn": "arn:aws:rds:us-west-2:112233445566:db:dbname",
"aws:SourceAccount": "112233445566"
}
}
}
]
}
- rds-s3-io-policy
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:GetObject",
"s3:AbortMultipartUpload",
"s3:DeleteObject",
"s3:ListMultipartUploadParts",
"s3:PutObject",
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::bucket_name",
"arn:aws:s3:::bucket_name/*"
]
}
]
}
I am attaching the policy to the role like so
aws iam attach-role-policy \
--policy-arn "arn:aws:iam::112233445566:policy/rds-s3-io-policy"\
--role-name "rds-s3-io-role"
Unfortunately, I can only add s3Import
or s3Export
like so
aws rds add-role-to-db-instance \
--db-instance-identifier "db_name" \
--feature-name s3Import \
--role-arn "arn:aws:iam::112233445566:role/rds-s3-io-role" \
--region us-west-2
How can I enable both s3Import
and s3Export
on the same database instance? Is there another 'feature' that I can somehow enable on the role that will allow me to use the aws_s3.query_export_to_s3()
and aws_s3.table_import_from_s3()
functions within PostgreSQL?