I am using the serverless framework and am encountering a very strange issue with the GSI definition within my serverless.yml
. When I use my original definition:
resources:
Resources:
GPSTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: joined
AttributeType: S
- AttributeName: serial
AttributeType: S
- AttributeName: timestamp
AttributeType: S
KeySchema:
- AttributeName: serial
KeyType: HASH
- AttributeName: timestamp
KeyType: RANGE
GlobalSecondaryIndexes:
- IndexName: ValidGPSIndex
KeySchema:
- AttributeName: joined
KeyType: HASH
- AttributeName: timestamp
KeyType: RANGE
Projection:
NonKeyAttributes:
- Altitude
- Altitude_Unit
- Checksum
- Fix_Quality
- GPS_Time
- HDOP
- Height_of_GEOID
- Height_of_GEOID_Unit
- Latitude
- Latitude_Direction
- Longitude
- Longitude_Direction
- No_of_Tracked_Satellites
- Time_Since_Last_DGPS_Update
ProjectionType: INCLUDE
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
The sls deploy
command gives me the following error:
So I changed serverless.yml
and added the appropriate ProvisionedThroughput property on the GSI, like so:
...
GlobalSecondaryIndexes:
- IndexName: ValidGPSIndex
KeySchema:
- AttributeName: joined
KeyType: HASH
- AttributeName: timestamp
KeyType: RANGE
Projection:
NonKeyAttributes:
- Altitude
- Altitude_Unit
- Checksum
- Fix_Quality
- GPS_Time
- HDOP
- Height_of_GEOID
- Height_of_GEOID_Unit
- Latitude
- Latitude_Direction
- Longitude
- Longitude_Direction
- No_of_Tracked_Satellites
- Time_Since_Last_DGPS_Update
ProjectionType: INCLUDE
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
...
Now, running sls deploy
gives me this error:
Anyone have any ideas how I can properly deploy my table? Unfortunately, I'm kinda stuck using the serverless framework, though I think in a very quick pinch I can convert this to a SAM application. I'd like to see what help the community can provide first. Thank you.
You just have an indentation issue. The ProvisionedThroughput
property is part of the index, not the Projection
.