You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many times you might want to create logical objects that have more complex data, such as images or videos, as part of their structure. For example, you might create a Person type with a profile picture or a Post type that has an associated image. With AWS AppSync, you can model these as GraphQL types, referred to as complex objects. If any of your mutations have a variable with bucket, key, region, mimeType and localUri fields, the SDK uploads the file to Amazon S3 for you.
582
+
583
+
For a complete working example of this feature, see [aws-amplify-graphql](https://github.com/aws-samples/aws-amplify-graphql) on GitHub.
584
+
585
+
If you're using AWS Amplify's GraphQL transformer, then configure your resolvers to write to DynamoDB and point at S3 objects when using the `S3Object` type. For example, run the following in an Amplify project:
586
+
587
+
```bash
588
+
amplify add auth #Select default configuration
589
+
amplify add storage #Select S3 with read/write access
590
+
amplify add api #Select Cognito User Pool for authorization type
591
+
```
592
+
593
+
When prompted, use the following schema:
594
+
595
+
```graphql
596
+
typeTodo@model {
597
+
id: ID!
598
+
name: String!
599
+
description: String!
600
+
file: S3Object
601
+
}
602
+
typeS3Object {
603
+
bucket: String!
604
+
key: String!
605
+
region: String!
606
+
}
607
+
inputCreateTodoInput {
608
+
id: ID
609
+
name: String!
610
+
description: String
611
+
file: S3ObjectInput # This input type will be generated for you
0 commit comments