AWS DynamoDB Flashcards
What type of database is DynamoDB
It is a key/value store, but it, not 100% true as the value can be more complex like JSON.
Can you have a secondary index?
Yes
Is DynamoDB deployed to a server or cluster?
No, it is a managed service from AWS you consume it as a service and scaling is performed automatically by AWS
Is DynamoDB a NoSQL database?
Yes, it is a NoSQL database.
Can I have joines in DynamoDB?
No, this database is a NoSQL key-value/document DB
Is DynamoDB encrypted by default for data at rest?
Yes
Is DynamoDB a schemaless database?
Yes unlike SQL thereis schemes, DynamoDSB is not.
Can I use my own customer managed key?
Yes you can use CMK
What does one read capacity unit represent?
It represents on strong consistent read or two eventual consistent reads, per 4K read. If you read over 4K then dynamoDB will consume one or more read unity.
What is a table in DynamoDB?
It a collection of items
What is an item in DynamoDB?
It is a uniquely identifiable collection of attributes.
What is an attribute in DynamoDB
Each items is composed of one or more attributes with atribute been a PersonID, LastName, FirstName.
Is a primary key on an attribute?
No, th eprimary key is on the item, this is a unique idenifier.
Can I create a backup of a DynamoDB table?
Yes, in the console, API or CLI.
You can restore from the backup.
When restoring from a DynamoDB backup, can I restore to the same table?
Yes, enter same table name for the restore
When restoring from a DynamoDB backup, can I restore to a different table?
Enter a different table name
With DynamoDB can I reserve storage capacity?
No as with storage you pay for only what you use as you use it.
I have a consistent known number of read/write capacity units I use 24/7/365, what can I do to save on cost?
I can purchase reserved capacity for both read and write, this can be for 1 - 3 years.
When you delete a table, are backups automatically deleted?
No.
Are DynamoDB tables encrypted at rest by default?
Yes, but you have the option to switch off encryption.
What is the default read and write capacity units?
5 x 5
Is DynamoDB handled at a database with a collection of tables or individual tables?
Individual tables, for example, when you want to copy all tables belong to your app, you have to do it per table. All configs are per table.
When you perform a write to DynamoDB, is the data written to another AZ?
Yes, in fact, it is written to a min of 3AZ.
When I preform a eventual consistant read on DynamoDB, am i geeteting the last write to the DB table?
No, reading again may give you different result.
When I preform a strong consistant read on DynamoDB, am i geeteting the last write to the DB table?
Yes you are geteting the most recent write to the DB table.
I ahve a laptop dev environmet and I wnat to develop again DynamoDB, what options do i have?
You have the ability to use the offline dev version of dynamodb
What is a DynamoDB table?
It is a collection of items
What is a DynamoDB item?
It is a colection of attributes.
Is DynamoDB a columer DB?
No is is a key-value and document DB.
What is the DynamoDB partation/has key?
This is the ley used on a table to distrubute the date and and is used to get access to the data.
What is a DynamoDB range key?
This key is used for searching, you can have ==, >, =, >=, “begines width”, “between”
When I prefrom a write to DynamoDB, is all the writes to the three AZ’s synchrous?
No, they are eventual consistant
When I preforma a write to DynamoDB, how long will it take for the data to becomes consistant?
about 1sec.
What size is a read/write capacity unit?
4K
How is DynamoDB priced?
It is based on through put, this is with capacity units.
What dose a read capacity unit represent?
It is a single read of a 4K bloock of data using strong consistancy.
Or, two consistant reads.
If I have a 8K block of data, how may capacity units will it take to read that data using strong consistancy?
2, as there will be 8K and this is tow 4K rreads.
I have fluctation read and write on my DynamoDB table, what cna I do to ensure I pay the minium?
Enable autoscaling and configure min and max. Or enables on-demand and pay for what you use, these is a small permium cost.
I need to ensure that alll the data is weote to DB using ACID trancation, as DynamoDB is a No-SQL DB, dose this means thta i have to use RDS?
No, DynamoDB supports ACID transactions.
Is an attribute a single value or a key value pair?
It is a key value pair.
I have an web application that uses DyanamoDB, this application serves customers in both the usa and ireland, I wnat to ensure that both sets of locations get service, I need a single db, what options do I have?
You can use DynamoDB global table to create a table in a second region.
I am currrently using provisioned capacaity unity, I have spily workloads, what are my options?
you can switch to on-demand where you only pay for what you use, but you also pay a surge charge. Or you can swithc to auto scaling.
What is strong consistancy?
When you read data from a DynamoDB table, the response might not reflect the results of a recently completed write operation. The response might include some stale data. If you repeat your read request after a short time, the response should return the latest data.
What is evantual strong?
When you request a strongly consistent read, DynamoDB returns a response with the most up-to-date data, reflecting the updates from all prior write operations that were successful. A strongly consistent read might not be available if there is a network delay or outage. Consistent reads are not supported on global secondary indexes (GSI).
Where will DyanamoDB store data?
In partations.
Where are partations stored?
They are stored on SSD and replicated across multipal AZ’s in the same region.
How will DynamoDB know where to find you data when you ask for it?
It used the partation key (hash) to locate the partation where the data is stored. You can alos use partatuion key and a sort key, data is stored in a partation and ordered by the sort key.
What application types is DyanamoDB good for?
Web-scale workloaded like,
- gaming
- media sharing
- IoT
I need ot have DyanamoDB backed up, how can I have this preformaned?
Ypu can enable point in time backups of the table. You cna also take an on-demand backup of the database.
I need to take a backup of the database for long term retention of a year, will point in time backup work for me, if not what other options do i have?
you can use point in time backups as you only get 35 days retention time. You cna use ondamand backupps. to storage a backup for long periods.
I have a dynamodb table with items, can I add a global table?
No the global table can only be added while these is no items in the table.
My ORG has a policy for encryption at rest, what DynamoDB options do I have?
Enable encryption on the DynamoDB table and use one of the following encryption keys methods,
- AWS owned CMK
AWS managed CMK Key is stored in your account and manged by KMS.
I need to make changes across 3 DynamoDB tables and have ACID transactions, what options do I have?
DynamoDB has transactions, you can group Put, Delete or Updates into a single group to be executed in all or nothing ACID transaction.
I require a database using query and index but not joins, what are my best options?
As you do not need joins, DynamoDB has what you need.
I required joins and need a fixed schema, what is my best option is it DynamoDB?
Do not use DynamoDB as it is not designed for joins, RDS may be a better option.
What is the use case for DynamoDB?
Highly available, scalable, no joints required, suited for -mobile apps -gaming -digital shopping cart - web session managment
I need complex joints in my relational data, is DynamoDB a good option?
No, joins or relationship data is not somethingDynamoDB dose very well, RDS is a better option here.
I want to store blob data in DynamoDB, why is this not a good idea?
You pay for each 4K read, blob data tends to be large, S3 is a better option here for blob data.
Is DynamoDB a good option for applications already wrote?
No, RDS is a better option.
By default is DynamoDB strongly consistent where you get back the last write?
No, by default DynamoDB is eventually consistent.
Is Dynamo DB global or regional service?
DynamoDB is a regional service unless you configure replication your data stays in that region.
What is a DynamoDB Item?
It is much like a traditional DB
I wnat to configure Dynao
DB nodes so I have my masters and slaves in a single region, how can I configure this?
You can, DynamoDB is 100% service with no nodes, its has capacity units you can use to govern read/write capacity.
What is the only mandatory requirement in an item (table)?
It is the primary key, the rest of the data has no structure (schema)
What is the max size of an item?
400KB
How much data can I write with 1 write capacity unit?
1KB
How much data can I read with a 1 read capacity unit?
4KB
I have an item (table) with 25 attributes (fields), and the item is 12KB in size, I read an attribute that is 30 bytes in size, how many capacity units do I use?
You are reading the 30 bytes, but Dynamo only allows you to read a complete item, in our case, the item is 12KB in size so you will have read 12KB and as each capacity unit for reading is 4KB you will have used 3 capacity units.
I do a search and return 3 12KB tables, how may read capacities do I use?
9, you use 9 because each item is 3 capacity units
I do a search and return 3 10byte tables, how may read capacities do I use?
3, each item is 10 bytes and you can only consume a whole read capacity unit so you will consume 3 1KB capacity units.
Do filers reduce the items with regard to capacity units read?
No, thye only filters the results, you will still use the read capacity units.
Should I use queries or scans?
You should use query as scenes are expensive as it reads every item in the database.
Can I have duplicate primary keys in a table?
No, primary keys have to be unique.
For DynamoDB, what is the only mandatory requirement for a table?
To have a primary key.
What is the max size of an item?
400KB
What is contained in a Table?
Items
What is contained in an Item
Attributes, primary key and sort keys.
What are a partition and a primary key and a hash key?
They are the same thing, they are used for and where to store the data in the partitions.
Can I have two items in a table with the same primary key?
No, it has to be unique.
What are you billed for in DynamoDB?
The sum of all the dat in the database and ale R/W throughput.
What is R/W capacity?
When you read item dat by query or by scan you will consume a read unit for each 4K block of data. When you write tan item or attribute, each 1K block of dat is written is a write unit.
What are the two modes of capacity?
On-demand
Provisioned
If I have a table with an item and that item has 10 bytes as a string primary key, if I read it how many capacity units will I consume?
one because of even tho you only read 10bytes, you can not consume a partial capacity unit.
I require a DynamoDB with 100GB of data, what will the read/write capacity be?
10,000 Write
30000 Read
If I have 20GB of data, how many partitions do I have?
Two
If I have one partition and I add a 1K write capacity units, how many partitions do I have?
two, one will be added for each 1K write capacity
If I have one partition and I add a 3K read capacity units, how many partitions do I have?
two, one will be added for each 3K write capacity
When I add a partition to my DynamoDB, can I remove it if not used?
No
Where I am using provisioned capacity units and I grow the data, what happens to my read and write capacity for each partition?
It is reduced as the overall r/r capacity is split between all partition for my data.
What is the table capacity unit buffer?
Where I am using provisioned capacity units and I grow the data, what happens to my read and write capacity for each partition?
I have a DynamoDB in production, I wnat to create a local secondary index, what is the process for doing this?
You cna only create a secondry index at the table creation time.
I have a DynamoDB table in production, I see issues from the developers needing to be able to query on another attribute in the database, how can I solve this?
You will have to create a global secondary index.
When creating a secondary index, why are you projecting attributes?
When you perform a read with this secondary index, you can only read any projected attribute.
I wnat to query no primary key value, what is my most efficient option?
Create a global secondary index.
What is the consistency model for DynamoDB
It is the eventual consistent. and immediate consistency, you get to choose based on the operation.
How much of capacity does an eventually consistent operation use?
Where I am using provisioned capacity units and I grow the data, what happens to my read and write capacity for each partition?
Can I perform a backup of the DynamoDB,?
Yes
Where is the data stored for a backup of dynamodb?
In s3
When doing a backup of DynamoDB table, what will be stored?
The data, and table configuration, you will be able to restore the Table 100%.
I have a requirement to be able to recover from a point in time during normal operation of my DynamoDB table, what functionality do I need to enable?
You need to enable Point-in-time recovery
My organization mandate that we need to need to have all data encrypted at rest and in transit, what do I need to do for DynamoDB
For DynamoDB, encryption is not enabled by default for data at rest, you can enable encryption. Data in transit used HTTPs with TLS, so it is encrypted.
When enabling data at rest encryption for DynamoDB, , what options do I have for keys?
You cna use server-side encryption using AWS CMK or KMS customer master key.
I need to perform an atomic operation in DynamoDB, is this possible/?
Yes, DynamoDB has Transactions.
I wnat to add monitoring of my DynamoDB table, how cna I do this?
DynamoDB emits metrics to CloudWatch.
Can I have reserved capacity on DynamoDB?
You can purchase reserved capacity
I am concerned about DynamoDB to spend and I wnat to place a cap on, I understand this may affect performance, what can I do?
Make sure I am using provisioned capacity units, as the capacity will be spread over all partitioned data.
What is a DynamoDB stream?
They are streams of timed ordered and partitioned changelog
How can you access DynamoDB streams?
You cna use Lambda, Kinesis Client Library, API
What is a DynamoDB trigger?
This is where an item changes in the DynamoDB and a trigger fires and lambda is called.
When you wnat to enable triggers for DynamoDB, what else do you need to enable?
Streams, streams are required to be enabled, you also defined in streams the type of data you wnat send to the trigger, like now and the old item or just new.
I wnat to have a DynamoDB item expire automatically, what is my best option?
Use TTL, TTL enables you to have items expire automatically based on dat time.
What is a GlobalTable?
It is a master/master replication.
I have a table full of dat and I wnat to create a global table, how cna I do this?
You can, tables have to be empty
I wnat to create a distributed version of DynamoDB table across multiple regions, I wnat to be able to read and write in both regions, what options do I have?
You can create your DynamoDB table in region 1 and then create a global table in a second and third region. This has to be done when there is no data in the table.
I need to be able to monitor what is happening in my DynamoDB form an R/W capacity, what options do I have?
DynamoDB is integrated with ClopudWatch.
I am creating a mobile application and I wnat direct access to an online database, I have identified I would like to use DynamoDB, is it possible and how could I configure this?
Yes, you can use web federation with cogneto and then use the filed graned access control policies on the DynamoDB table to allow or deny GetItem, PutItem, etc.
What are triggers used for in DynamoDB?
You use triggers to enable code to be called with the DynamoDB table is updated. You have to set up streams to enable this and make a stream config for new, old, new + old items to be sent as part of the trigger.
I am concerned about the recovery of my DynamoDB in the event of database corruption, what options do I have and how cna I configure it?
DynamoDB has a backup feature that stores the table for up to 35 days, in S3 stores in the region, both the table and logs are backed up so you can recover to any point.
How cna I set up a schedule to backup my DynamoDB?
DynamoDB has no scheduled task for DB backup, you have to create a chron job.
When creating DynnamoDB in multi-regions, is it master/slave or master/master.
Master/Master
In DynamoDB what are the sizing values of a partition table?
10GB
1K Write
3K Read
Can I have duplicate primary keys?
No, it has to be unique.
What is the max size of an item?
400KB
What is a multipart primary key and how is it used?
A primary key cna have a sort key, both can be used to select an item form DynamoDB table.
How many times is data replicated across the regions for data durability?
It is not, data is only replicated to 3 separate facilities within the same region.
How many times is data replicated in the same region for DynamoDB table?
three, data is sync replicated to three separate facilities in the same region.
We have to add 10M new customer to our DynamoDB, what do I need to configure to increase capacity?
I do now need to do anything, DynamoDB scales horizontally
Explain the consistency model for accessing a DynamoDB table?
These are two models for reading data, eventual and strong. Eventual means you may get a copy of old data, strong means you will get the latest data. Eventual used half the read capacity unity that would have been used for strong consistency.
Can you perform strong consistent ready on the secondry index?
Query operations cannot perform strongly consistent reads on Global Secondary Indexes
What is DybamoDB FGAC?
This is the filed graned access control, this is a policy attached to a table to enable you to control access, this policy can be used with cognate (web identity) or AWS IAM.
Is data in transit encrypted?
Yes.
What encryption algorithm is used for encrypting DynamoDB?
AES256
Which of the following are use cases for Amazon DynamoDB? Choose 3 answers
- Storing BLOB data.
- Managing web sessions
- Storing JSON documents
- Storing metadata for Amazon S3 objects
- Running relational joins and complex updates.
- Storing large amounts of infrequently accessed data.
- Storing BLOB data. (NO)
- Managing web sessions (YES)
- Storing JSON documents (YES)
- Storing metadata for Amazon S3 objects (YES)
- Running relational joins and complex updates.(NO)
- Storing large amounts of infrequently accessed data. (NO)
if you use more read capacity they you have allocated what will happen to the requests?
You will be throttled, but your request will be serviced and you will not receive an error.
What is the read and write capacity unite size?
Read = 4K Write = 1K
What is the difference between sort and filter on capacity unity?
The sort will reduce the data returned and also the data that is touched and as such the number of read capacity units used. The filter just filters after the dat is returned and does not save on read capacity units.
If I have a write contention issue with DynamoDB, what is the best way to solve it?
Use DynamoDB Autoscaling. Possible other option is to use SQS.
When you read an attribute in an item, what are you paying for?
You pay for all the attributes in the item. In other words, you pay for the whole item, not just the attribute you want.
What am I paying for in DynamoDB?
- Paying for storage
- Read/Write capacity
If I write 1byte of data to DynamoDB, how much of a capacity unit will I use?
You will use a 1KB capacity unit and be changed for the 1KB unit.
If I read 1byte of data from DynamoDB, how much of a capacity unit will I use?
You will use a 4KB capacity unit and be changed for the 4KB unit.
If I read 16KB of data form DynbamoDB, what am I charged for?
You are charged for 4 x 4KB read capacity units
If I read 2KB of data form DynbamoDB, what am I charged for?
You will have used 1/2 of a 4K read capacity unit but you will be charged for the whole capacity unit
How can I ensure I keep cost at a min when querying DynamoDB?
Use the sort key to only return the items you need. This way you only pay for the returned items.
If I am adding a filter to my query, will this reduce the cost?
No, the filter is applied after the results are returned and you pay for every item in the results before the filter.
Do I use the sort key to filter to reduce cost and why?
The sort key, soft key limits the returned items, the filter is applied after the results are returned.
What do I pay for when using scans?
Every item returned, there is no sort key and only filters and as we know filters are applied after the data is returned so you end up paying for every item.
What do I pay for when using scans + filters?
Every item returned, there is no sort key and only filters and as we know filters are applied after the data is returned so you end up paying for every item.
Why do I have to be very careful when using scan from a cost perspective in DynamoDB?
Because scan is going to go through every item in the table and return it even if you have the filter you will be paying for every item in the table.
Should I be using scans or queries?
Queries as they only return the items you filter by the sort key.
If I have one table and one partition and I now got to 15GB of storage in my table what will happen?
Each partition can only hold 10GB, another partition is created for the table.
If I allocate 10K write capacity unity, what will this cause my partitions to do?
Spread to 10 partitions, 1 (1K) partition for each of the IK writes.
If I have 6K read capacity units, how many partition tables will I have?
You will have 2, Each partition gives you 3K read capacity units.
Can I create a local secondary index after the table is created?
No, but you can create a global secondary index.
I wnat to query based on another attribute, how should I do this, with a scan, keep cost low?
Create a local or global secondary index and use it sort key
Explain how the global secondary index shares the read and write capacity units off the table?
The global secondary index does not share the read and write capacity of the table, it gets an allocation of its own.
What is the primary key mead up of?
The primary key and the sort key
I need a no-SQL DB like DynamoDB, I also need it to write and read consistent, is DynamoDB a good selection?
Could be? DynamoDB is eventually consistent but with the option for constant, an eventually consistent read uses half the write capacity compared to a consistent read that will use the full read capacity unit
I write data to DynamoDB and read it straight away, am I guaranteed to get the data I just wrote?
No, unless you opt to use a consistent read and this will use a full read capacity unit, other than that you an eventually consistent read.
I wnat to back up DynamoDB, what is my option and how does it work?
You can backup to s3 and restore from S3
When I do a table backup, where is it stored and is the metadata for the table such as the config also stored?
In s3 and yes metadata (config) is also stored and can be restored when needed.
Does DynamoDB support point in time backup, explain?
Yes, for a table you can enable point in time backups
When using table point in time recovery, what is the retention period?
35Days
My org has a encrypt data at rest policy, what option do I have with DynamoDB?
You can select to encrypt the DynamoDB table using AWS owned CMK or your own CMK.
DynamoDB is a no-sol database, I need to ensure I select a database with transactions, is DynamoDB a good option?
Yes, DynamoDB has transaction capabilities.
I know I am consistently using a number of reads and write capacity units and will be over the next 3 years, how can I lower my cost?
DynamoDB allows you to reserve read and write capacity units.
What are the 3 capacity modes available to DynamoDB?
- On-Demand
- Provisioned
- Autoscaled
I have a workload where I need I always want max performance with no upper limit, how would I achieve this?
Use on-demand, where you have no upper performance limits.
I have a workload where I need I want to set max performance, how would I achieve this?
Use provisioned capacity, this is where you set the exact read and write capacity units.
I have a workload where I wnat min cost and have the DynamoDB scale up and down with the workload, I achieve this?
Use auto-scaling where you get to set the min and max.
Should I be worried about hot partitions in DynamoDB, explain?
No, with adaptive capacity partition can borrow capacity form other partitions when available and needed.
When using streams what options can you chose form?
- Only keys in stream
- Entire item in the stream
- Old items in the stream before it was modified
- only and new items in the stream
Explain what triggers do?
Triggers connect streams to a lambda function, so as you get updates in the DynamoDB table you can take action in the Lambda.
I have a DunamoDB table for keeping stock, I wnat an alarm to be triggered when the stock falls below a min level, how can I do this?
- Enable streams
- Ensure the table has an attribute keeping track of the stock count
- Create a trigger and lambda to check the stock level
- Use SNS and the SNS SDK to send a notification.
I wnat to have an item in my DynamoDB deleted after a time period, how cna I do this?
Use TTL, you can use TTL to delete a DynamoDB item after a period when it expires.
I wnat to have items deleted in a DynamoDB table and also have an email sent to the operation system, how cna I do this?
You can use TTL to expire items, and use streams and triggers to trigger a lambda and have the Lambda use SNS SDK to send an email to topic subscribed users.
I wnat to create a backup of my table in a separate region got DR, would I use streams for this?
No streams are for use with triggers, to have a table in another region, you use global tables.
How can I have 3 DynamoDB tables, one in each region, us-east-1, us-west-1 and eu-west-1 and be able to write to all table and replicate the data between all tables?
DynamoDB can use the global table in the regions and any writes are async to all other tables.
I am creating a Global table, what do have have to enable?
- Streams
I have added data to my DynamoDB table and I wnat to now add a new global table region, how cna I do this?
You can, once data is added to the table you can not add global table regions.
I have a mobile application and I wnat to restrict access to the user’s own item in a DynamopDB table, is this possible?
Yes, IAM can be used with DynamoDB and has fine graned access to restrict the mobile user to only access the item in a table. This is done by using policy and a condition.
I have a mobile application and I wnat to restrict access to the user’s own attribute in an item in a DynamopDB table, is this possible?
Yes, IAM can be used with DynamoDB and has fine graned access to restrict the mobile user to only access the attribute in an item in a table. This is done by using policy and a condition.
I wnat to improve my read performance for DynamoDB to my users, I am thinking of a cache, I wnat it to be transparent, how and I do this?
Use DAX.
What is DAX?
It is an in-memory cache for DynamoDB.
I wnat DynamoDB to autoscaled my read-write capacity, is this possible?
Yes 100%, you can opt to have the read and write capacity scaled as required,
Can auto-scaling be applied to a secondary index?
Yes 100%, just like the primary index.
What is projection-expression?
It is when you only wnat certain attributes from the table, not the whole table.
What are the two scaling models in DynamoDB
- On-demand: You just consume what you need.
- Provisioned: You select the number of reading and write capacity unity. You also can set autoscaling.
Is provisioned and on-demand capacity for DynamoDB the same cost?
on-demand is more expensive
What is DynamoDB Accelerator (DAX)?
It is an in-memory cache for DynamoDB, improves performance by 10x read improvement.
How do I configure DAX for write acceleration?
You can’t, it is for reads not writes, DAX is an in-memory cache and improves reads by 10x.
Is DAX a SaaS or a cluster of nodes?
It is a cluster of nodes, you get to select the node size. (type) and the number of nodes.
When using DAX am I connecting to DynamoDB or to DAX?
You are connecting to DAX and DAX is connecting to DynamnoDB, DAX has a DAX client you use to connect to DAX from your code.
I wnat strong consistent reads and I am using DAX, is there an issue?
Yes, DAX will not help as the read is strongly consistent and will have to go to the DynamoDB for the requests.
I have a write-intensive DynamoDB workload, how cna DAX help?
No, DAX is for read caching only.
My application only requires millisecond response time, is DAX worth including in my solution?
No, DAS is good when you wnat microsecond response time.
What is the global table?
A global table is two tables one in each region that is replicated.
When using DynamoDB streams, how do I configure a lambda function to receive a stream changes?
- Enable streams
- Create a trigger