diff --git a/AUTHORS.md b/AUTHORS.md
index e85996125..08757d2bb 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -44,3 +44,4 @@ Moto is written by Steve Pulec with contributions from:
* [Jean-Baptiste Barth](https://github.com/jbbarth)
* [Tom Viner](https://github.com/tomviner)
* [Justin Wiley](https://github.com/SectorNine50)
+* [Adam Stauffer](https://github.com/adamstauffer)
diff --git a/moto/rds/models.py b/moto/rds/models.py
index 670b0a808..a499b134d 100644
--- a/moto/rds/models.py
+++ b/moto/rds/models.py
@@ -71,6 +71,11 @@ class Database(BaseModel):
# DBParameterGroupName
# VpcSecurityGroupIds.member.N
+ @property
+ def db_instance_arn(self):
+ return "arn:aws:rds:{0}:1234567890:db:{1}".format(
+ self.region, self.db_instance_identifier)
+
@property
def physical_resource_id(self):
return self.db_instance_identifier
@@ -231,6 +236,7 @@ class Database(BaseModel):
{{ database.address }}
{{ database.port }}
+ {{ database.db_instance_arn }}
""")
return template.render(database=self)
diff --git a/moto/rds2/models.py b/moto/rds2/models.py
index f03cf4ad1..eecb608dd 100644
--- a/moto/rds2/models.py
+++ b/moto/rds2/models.py
@@ -95,6 +95,11 @@ class Database(BaseModel):
self.character_set_name = kwargs.get('character_set_name', None)
self.tags = kwargs.get('tags', [])
+ @property
+ def db_instance_arn(self):
+ return "arn:aws:rds:{0}:1234567890:db:{1}".format(
+ self.region, self.db_instance_identifier)
+
@property
def physical_resource_id(self):
return self.db_instance_identifier
@@ -206,6 +211,7 @@ class Database(BaseModel):
{{ database.address }}
{{ database.port }}
+ {{ database.db_instance_arn }}
""")
return template.render(database=self)
@@ -349,7 +355,8 @@ class Database(BaseModel):
"Status": "active",
"VpcSecurityGroupId": "sg-123456"
}
- ]
+ ],
+ "DBInstanceArn": "{{ database.db_instance_arn }}"
}""")
return template.render(database=self)
diff --git a/tests/test_rds2/test_rds2.py b/tests/test_rds2/test_rds2.py
index 731bc75c1..1e2e0abdf 100644
--- a/tests/test_rds2/test_rds2.py
+++ b/tests/test_rds2/test_rds2.py
@@ -26,6 +26,8 @@ def test_create_database():
database['DBInstance']['MasterUsername'].should.equal("root")
database['DBInstance']['DBSecurityGroups'][0][
'DBSecurityGroupName'].should.equal('my_sg')
+ database['DBInstance']['DBInstanceArn'].should.equal(
+ 'arn:aws:rds:us-west-2:1234567890:db:db-master-1')
@disable_on_py3()
@@ -59,6 +61,8 @@ def test_get_databases():
list(instances['DBInstances']).should.have.length_of(1)
instances['DBInstances'][0][
'DBInstanceIdentifier'].should.equal("db-master-1")
+ instances['DBInstances'][0]['DBInstanceArn'].should.equal(
+ 'arn:aws:rds:us-west-2:1234567890:db:db-master-1')
@disable_on_py3()
@@ -333,26 +337,27 @@ def test_list_tags_db():
result = conn.list_tags_for_resource(
ResourceName='arn:aws:rds:us-west-2:1234567890:db:foo')
result['TagList'].should.equal([])
- conn.create_db_instance(DBInstanceIdentifier='db-with-tags',
- AllocatedStorage=10,
- DBInstanceClass='postgres',
- Engine='db.m1.small',
- MasterUsername='root',
- MasterUserPassword='hunter2',
- Port=1234,
- DBSecurityGroups=['my_sg'],
- Tags=[
- {
- 'Key': 'foo',
- 'Value': 'bar',
- },
- {
- 'Key': 'foo1',
- 'Value': 'bar1',
- },
- ])
+ test_instance = conn.create_db_instance(
+ DBInstanceIdentifier='db-with-tags',
+ AllocatedStorage=10,
+ DBInstanceClass='postgres',
+ Engine='db.m1.small',
+ MasterUsername='root',
+ MasterUserPassword='hunter2',
+ Port=1234,
+ DBSecurityGroups=['my_sg'],
+ Tags=[
+ {
+ 'Key': 'foo',
+ 'Value': 'bar',
+ },
+ {
+ 'Key': 'foo1',
+ 'Value': 'bar1',
+ },
+ ])
result = conn.list_tags_for_resource(
- ResourceName='arn:aws:rds:us-west-2:1234567890:db:db-with-tags')
+ ResourceName=test_instance['DBInstance']['DBInstanceArn'])
result['TagList'].should.equal([{'Value': 'bar',
'Key': 'foo'},
{'Value': 'bar1',