diff --git a/moto/rds2/models.py b/moto/rds2/models.py
index d2aa24a2..963af1c6 100644
--- a/moto/rds2/models.py
+++ b/moto/rds2/models.py
@@ -130,7 +130,9 @@ class Database(BaseModel):
if not self.option_group_name and self.engine in self.default_option_groups:
self.option_group_name = self.default_option_groups[self.engine]
self.character_set_name = kwargs.get("character_set_name", None)
- self.iam_database_authentication_enabled = False
+ self.enable_iam_database_authentication = kwargs.get(
+ "enable_iam_database_authentication", False
+ )
self.dbi_resource_id = "db-M5ENSHXFPU6XHZ4G4ZEI5QIO2U"
self.tags = kwargs.get("tags", [])
@@ -214,7 +216,7 @@ class Database(BaseModel):
{{ database.source_db_identifier }}
{% endif %}
{{ database.engine }}
- {{database.iam_database_authentication_enabled }}
+ {{database.enable_iam_database_authentication|lower }}
{{ database.license_model }}
{{ database.engine_version }}
@@ -542,7 +544,7 @@ class Snapshot(BaseModel):
{{ database.kms_key_id }}
{{ snapshot.snapshot_arn }}
- false
+ {{ database.enable_iam_database_authentication|lower }}
"""
)
return template.render(snapshot=self, database=self.database)
diff --git a/moto/rds2/responses.py b/moto/rds2/responses.py
index 7c815b2d..b63e9f8b 100644
--- a/moto/rds2/responses.py
+++ b/moto/rds2/responses.py
@@ -27,6 +27,9 @@ class RDS2Response(BaseResponse):
"db_subnet_group_name": self._get_param("DBSubnetGroupName"),
"engine": self._get_param("Engine"),
"engine_version": self._get_param("EngineVersion"),
+ "enable_iam_database_authentication": self._get_bool_param(
+ "EnableIAMDatabaseAuthentication"
+ ),
"license_model": self._get_param("LicenseModel"),
"iops": self._get_int_param("Iops"),
"kms_key_id": self._get_param("KmsKeyId"),
diff --git a/tests/test_rds2/test_rds2.py b/tests/test_rds2/test_rds2.py
index 9a5a7367..e93ff43e 100644
--- a/tests/test_rds2/test_rds2.py
+++ b/tests/test_rds2/test_rds2.py
@@ -1689,3 +1689,36 @@ def test_create_parameter_group_with_tags():
ResourceName="arn:aws:rds:us-west-2:1234567890:pg:test"
)
result["TagList"].should.equal([{"Value": "bar", "Key": "foo"}])
+
+
+@mock_rds2
+def test_create_db_with_iam_authentication():
+ conn = boto3.client("rds", region_name="us-west-2")
+
+ database = conn.create_db_instance(
+ DBInstanceIdentifier="rds",
+ DBInstanceClass="db.t1.micro",
+ Engine="postgres",
+ EnableIAMDatabaseAuthentication=True,
+ )
+
+ db_instance = database["DBInstance"]
+ db_instance["IAMDatabaseAuthenticationEnabled"].should.equal(True)
+
+
+@mock_rds2
+def test_create_db_snapshot_with_iam_authentication():
+ conn = boto3.client("rds", region_name="us-west-2")
+
+ conn.create_db_instance(
+ DBInstanceIdentifier="rds",
+ DBInstanceClass="db.t1.micro",
+ Engine="postgres",
+ EnableIAMDatabaseAuthentication=True,
+ )
+
+ snapshot = conn.create_db_snapshot(
+ DBInstanceIdentifier="rds", DBSnapshotIdentifier="snapshot"
+ ).get("DBSnapshot")
+
+ snapshot.get("IAMDatabaseAuthenticationEnabled").should.equal(True)