When we exec() a Scanamo call, we now access an instance of Scanamo that wraps an AWS DynamoDB client, rather than supplying an AWS DynamoDB client to the Scanamo singleton. This means most of the DataStore classes in media-atom-maker now accept a Scanamo instance rather than a AmazonDynamoDBClient (https://github.com/scanamo/scanamo/pull/406 - 1.0.0-M10).
Query on entity keys by name as a String ("id"), rather than using the old 'Symbol' apostrophe syntax ('id - see 1.0.0-M11), and use === rather than -> to specify the required key value (1.0-M13).
The AWS SDK v1 → v2 requirement of Scanamo was the tricky one to handle- a lot of code media-atom-maker also makes AWS SDK calls to lots of other services, and I didn't want to have to fix all of it to use AWS SDK v2 in this change.
Instead, this change introduces com.gu.media.aws.CredentialsForBothSdkVersions, which makes a choice of AWS SDK v1 or v2 credentials available in the already-existing com.gu.media.aws.AwsCredentials class. This allows a partial move to AWS SDK v2, while other parts of the code remain on AWS SDK v1 for now. Notably, we need both v1 and v2 versions of the DynamoDB client, as the atom-maker libraries in guardian/atom-maker still use AWS SDK v1.
This is a necessary precursor to the Scala 2.13 upgrade in PR https://github.com/guardian/media-atom-maker/pull/1147, as Scanamo 1.0.0-M9 only supports Scala 2.11 & 2.12.
Here we're moving up from Scanamo 1.0.0-M9 to 1.0.0-M28, which involves several changes to requirements:
exec()
a Scanamo call, we now access an instance of Scanamo that wraps an AWS DynamoDB client, rather than supplying an AWS DynamoDB client to theScanamo
singleton. This means most of theDataStore
classes inmedia-atom-maker
now accept aScanamo
instance rather than aAmazonDynamoDBClient
(https://github.com/scanamo/scanamo/pull/406 - 1.0.0-M10).DynamoFormat
handlers are now created withorg.scanamo.generic.auto._
rather thanorg.scanamo.auto._
(https://github.com/scanamo/scanamo/pull/538 - 1.0-M12)"id"
), rather than using the old 'Symbol' apostrophe syntax ('id
- see 1.0.0-M11), and use===
rather than->
to specify the required key value (1.0-M13).The AWS SDK v1 → v2 requirement of Scanamo was the tricky one to handle- a lot of code
media-atom-maker
also makes AWS SDK calls to lots of other services, and I didn't want to have to fix all of it to use AWS SDK v2 in this change.Instead, this change introduces
com.gu.media.aws.CredentialsForBothSdkVersions
, which makes a choice of AWS SDK v1 or v2 credentials available in the already-existingcom.gu.media.aws.AwsCredentials
class. This allows a partial move to AWS SDK v2, while other parts of the code remain on AWS SDK v1 for now. Notably, we need both v1 and v2 versions of the DynamoDB client, as the atom-maker libraries in guardian/atom-maker still use AWS SDK v1.Testing
This deploys successfully to CODE, and https://video.code.dev-gutools.co.uk/videos is still accessible:
I was able to make a small metadata change without any obvious problems:
I'd need to pair with someone on the Content Production team to double check that all functionality, including the AWS lambdas, are working correctly!