Defining attributes is only really necessary when you want to create global secondary indexes with them later in cloudformation. All primary and secondary keys and should first be defined as attributes Answer from awsfanboy on reddit.com
🌐
AWS
docs.aws.amazon.com › amazon dynamodb › developer guide › working with tables, items, queries, scans, and indexes › working with items and attributes in dynamodb
Working with items and attributes in DynamoDB - Amazon DynamoDB
The basic building blocks of Amazon DynamoDB start with tables, items, and attributes. Learn how to work with these and basic CRUD operations to start building powerful and scalable applications.
🌐
Medium
medium.com › simple-thoughts-amplified › adding-an-attribute-to-a-dynamodb-item-bcc8972aaf54
Adding an Attribute to a DynamoDB Item | by Alan Williams | Simple Thoughts Amplified | Medium
June 8, 2016 - To set context, in DynamoDB, AWS’s managed NoSQL (schema-less) service, the name of a table record is an Item and each field/column of that Item is called an Attribute.
Discussions

What are attribute definitions in DynamoDB CloudFormation template?
Defining attributes is only really necessary when you want to create global secondary indexes with them later in cloudformation. All primary and secondary keys and should first be defined as attributes More on reddit.com
🌐 r/aws
4
3
October 23, 2022
database - What's the difference between attribute and key in dynamodb query - Stack Overflow
Whats the significance of having ... attribute when im making a query? ... While both a Scan with a FilterExpression and a Query with KeyConditionExpression may return the same results, there is a big difference in the way this is done, its performance, and the cost to you. In your case, it is strongly preferrable to use a Query, not a Scan. Let me explain: A Scan always scans the entire table. It may filter out things according to FilterExpression, but DynamoDB still needs ... More on stackoverflow.com
🌐 stackoverflow.com
amazon web services - AWS DynamoDB Attribute Names containing Spaces - Stack Overflow
I have an AWS DynamoDB table that is populated via a Lambda script triggered by a web form. The table ends up with Attribute Names like "Full Name" and "Phone Number". From the ... More on stackoverflow.com
🌐 stackoverflow.com
amazon web services - Limit on Number of Attributes in Table DynamoDB? - Stack Overflow
Hi I currently have a list of dictionaries I am trying to insert into DynamoDB (each dict as an item). Each item having a hashkey and label1,label2,...label3000 key/value pairs with label# being th... More on stackoverflow.com
🌐 stackoverflow.com
🌐
AWS
docs.aws.amazon.com › amazon dynamodb › developer guide › amazon dynamodb: how it works › core components of amazon dynamodb
Core components of Amazon DynamoDB - Amazon DynamoDB
Learn about the building blocks of DynamoDB your app will need. You'll discover the basics of tables, items, attributes, and how they work together to make a database for any scale you may need.
🌐
AWS Fundamentals
awsfundamentals.com › blog › aws-dynamodb-data-types
AWS DynamoDB Data Types
September 12, 2022 - You can see that the user now has an attribute subscription with a simple object customer_id and plan_id. This makes DynamoDB very powerful.
🌐
GeeksforGeeks
geeksforgeeks.org › python › dynambodb-tables-items-and-attributes
DynamoDB - Tables, Items, and Attributes - GeeksforGeeks
October 8, 2021 - The fundamental data element of DynamoDB. It uses Primary keys to identify every item in the table and the secondary indexes to allow more flexible querying. A table can have multiple or zero items.
🌐
Reddit
reddit.com › r/aws › what are attribute definitions in dynamodb cloudformation template?
r/aws on Reddit: What are attribute definitions in DynamoDB CloudFormation template?
October 23, 2022 -

I am trying to figure out how to use DynamoDB with CloudFormation. When I go through the dashboard to create DynamoDB, there are no options to define attributes other than indices. However, in CloudFormation, there are AttributeDefinitions field: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-attributedefinitions

What happens when I define these attributes? By default, when I create the table from the web interface, I can create any attribute to any document/item. Will defining these attributes disallow adding other attributes into the table?

Find elsewhere
🌐
AWS re:Post
repost.aws › knowledge-center › dynamodb-table-restrict-attributes
Restrict an IAM user or role to specific attributes in a DynamoDB table | AWS re:Post
May 23, 2022 - Here's an example of a query request that returns an AccessDeniedException because it doesn't use Select or ProjectionExpression to specify allowed attributes: $ aws dynamodb query --table-name GameScores --key-condition-expression "UserId = :useridval" --expression-attribute-values '{":useridval":{"S":"stefano_123"}}'
🌐
GeeksforGeeks
geeksforgeeks.org › dynamodb › aws-dynamodb-working-with-items-attributes
AWS DynamoDB - Working with Items & Attributes - GeeksforGeeks
July 23, 2025 - We observe that each item contains a different number of attributes. One attribute MovieID should always be present in each item and its value cannot be the same in two items as it is the primary key. To create items, first, we must create a table in DynamoDB with a partition key.
Top answer
1 of 2
2

While both a Scan with a FilterExpression and a Query with KeyConditionExpression may return the same results, there is a big difference in the way this is done, its performance, and the cost to you. In your case, it is strongly preferrable to use a Query, not a Scan. Let me explain:

A Scan always scans the entire table. It may filter out things according to FilterExpression, but DynamoDB still needs to read all the items in table, and you will pay for these reads. Doing a scan with a very selective FilterExpression (which only returns a small subset of the table) is almost always a bad idea. It will be very slow and cost you a lot, relative to the amount of data you are trying to read.

On the other hand, Query can efficiently skip directly to the partition you asked for (the KeyConditionExpression can only specify a single partition key), and inside this partition, read only the sort-key range which you specified in KeyConditionExpression. The time it takes to do that, and the cost to you, will only be proportional to the number of items you actually read - even if those are only a small subset of the entire table.

Query can do this efficiently because of the way DynamoDB partition keys and sort keys work: The partition key is also called a "hash key" because it allows DynamoDB to find the specific partition efficiently, as in a hash table, without scanning the entire table. Then, inside one partition, items are sorted by the sort key, so to find a contiguous range of sort keys (as KeyConditionExpression allows to specify), DynamoDB does not need to scan all the items in the partition - it can find the requested range efficiently in O(logN).

2 of 2
0

Scan operation is very expensive as it requires to read the entire table. In addition, scan operation is a sure way to him DynamoDB's 1MB limit of the amount of data it can retrieve, so you will likely end up having to do multiple scans and using NextToken to continue scanning your table. It is not recommended to use scan in most cases.

Here you can find more about scan operation.

A key attribute in DynamoDB can be a subject to conditions in query while non-key attribute can't. Also, DynamoDB supports only = (equal) condition on primary key attributes.

Here you will find more on how to choose the right partition key.

🌐
Anatomy of an Item
dynamodbguide.com › anatomy of an item
Anatomy of an Item | DynamoDB, explained.
January 1, 2018 - It is comparable to a row in a ... key that is set on a table level. An item is composed of attributes, which are bits of data on the item....
Top answer
1 of 3
8

There is no limit to the number of attributes but the total item size is limited to 400kb.

Items

Item Size

The maximum item size in DynamoDB is 400 KB, which includes both attribute name binary length (UTF-8 length) and attribute value lengths (again binary length). The attribute name counts towards the size limit.

For example, consider an item with two attributes: one attribute named "shirt-color" with value "R" and another attribute named "shirt-size" with value "M". The total size of that item is 23 bytes.

Attributes

Attribute Name-Value Pairs Per Item

The cumulative size of attributes per item must fit within the maximum DynamoDB item size (400 KB).

Number of Values in List, Map, or Set

There is no limit on the number of values in a List, a Map, or a Set, as long as the item containing the values fits within the 400 KB item size limit.

Docs

2 of 3
4

A Dynamodb table can have any number of attributes but while writing a particular row the number of attributes is limited as the cumulative size of an attribute name and attribute value should not exceed 400KB.

Mathematically speaking if the row you are writing has an average attribute size of 7 bytes and the corresponding value for it has a size of 6 bytes then you can have approximately 400 * 1024/13 ~ 31507 attributes for that entry.

If you make another such entry with an entirely different attribute name set then overall your table will have 63014 attributes.

Keep in mind each entry has a limit of 400KB, but the table can have any number of attributes.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-attributes

🌐
Codemia
codemia.io › home › knowledge hub › amazon dynamodb attribute type with cloudformation
Amazon DynamoDB Attribute Type with CloudFormation | Codemia
July 30, 2025 - Note: CloudFormation does not directly use attribute types for Boolean, Null, List, or Map, as these types are dynamically typed in transaction-based operations. Amazon DynamoDB’s flexible attribute types combined with CloudFormation's detailed configuration options provide a robust platform for building scalable applications.
🌐
Helius
heliuswork.com › home › attribute in an amazon dynamodb table
Attribute in an Amazon DynamoDB Table
April 18, 2025 - Non-key attributes: While key attributes are used to uniquely identify an item, non-key attributes are not used to do the same. But they carry additional information and have multiple instances in the table. The AWS DynamoDB attribute data types fall under three categories, such as
🌐
AWS
docs.aws.amazon.com › amazon dynamodb › developer guide › working with tables, items, queries, scans, and indexes › working with items and attributes in dynamodb › using expressions in dynamodb › expression attribute names (aliases) in dynamodb
Expression attribute names (aliases) in DynamoDB - Amazon DynamoDB
When querying or scanning in Amazon DynamoDB, use an expression attribute name, a placeholder used as an alternative to an actual attribute name in an expression. An expression attribute name is an alias placeholder that is used in an Amazon DynamoDB expression as an alternative to an actual ...
🌐
DynamoDB
dynobase.dev › dynamodb-data-types
DynamoDB Data & Attribute Types - Complete List [2026]
February 25, 2020 - Just like with Strings, binary length is limited by the maximum item size, which is 400 KB. Binaries must be encoded using base64 before being sent to DynamoDB. Binary types can also be used for keys and they have the same length restriction rules as Strings. The size of a binary attribute is (length of attribute name) + (number of raw bytes).
🌐
AWS
docs.aws.amazon.com › amazon dynamodb › api reference › data types › amazon dynamodb › attributevalue
AttributeValue - Amazon DynamoDB
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself. For more information, see Data Types in the Amazon DynamoDB Developer Guide.