Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions lib/backend/dynamo/dynamodbbk.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,32 +284,39 @@ func New(ctx context.Context, params backend.Params) (*Backend, error) {

dynamoOpts := []func(*dynamodb.Options){dynamodb.WithEndpointResolverV2(dynamoResolver)}

streamsResolver, err := endpoint.NewLoggingResolver(
dynamodbstreams.NewDefaultEndpointResolverV2(),
l.With(slog.Group("service",
"id", dynamodbstreams.ServiceID,
"api_version", dynamodbstreams.ServiceAPIVersion,
)),
)
if err != nil {
return nil, trace.Wrap(err)
}

streamsOpts := []func(*dynamodbstreams.Options){
dynamodbstreams.WithEndpointResolverV2(streamsResolver),
}

// FIPS settings are applied on the individual service instead of the aws config,
// as DynamoDB Streams and Application Auto Scaling do not yet have FIPS endpoints in non-GovCloud.
// as Application Auto Scaling do not yet have FIPS endpoints in non-GovCloud.
// See also: https://aws.amazon.com/compliance/fips/#FIPS_Endpoints_by_Service
useFIPS := dynamodbutils.IsFIPSEnabled()
if useFIPS {
dynamoOpts = append(dynamoOpts, func(o *dynamodb.Options) {
o.EndpointOptions.UseFIPSEndpoint = aws.FIPSEndpointStateEnabled
})
streamsOpts = append(streamsOpts, func(o *dynamodbstreams.Options) {
o.EndpointOptions.UseFIPSEndpoint = aws.FIPSEndpointStateEnabled
})
}

otelaws.AppendMiddlewares(&awsConfig.APIOptions, otelaws.WithAttributeSetter(otelaws.DynamoDBAttributeSetter))

dynamoClient := dynamodb.NewFromConfig(awsConfig, dynamoOpts...)

streamsResolver, err := endpoint.NewLoggingResolver(
dynamodbstreams.NewDefaultEndpointResolverV2(),
l.With(slog.Group("service",
"id", dynamodbstreams.ServiceID,
"api_version", dynamodbstreams.ServiceAPIVersion,
)),
)
if err != nil {
return nil, trace.Wrap(err)
}

streamsClient := dynamodbstreams.NewFromConfig(awsConfig, dynamodbstreams.WithEndpointResolverV2(streamsResolver))
streamsClient := dynamodbstreams.NewFromConfig(awsConfig, streamsOpts...)
b := &Backend{
logger: l,
Config: *cfg,
Expand Down
Loading