aws cloudformation create-stack \
--stack-name AWSAppSyncTutorialForAmazonDynamoDB \
--template-url https://s3.us-west-2.amazonaws.com/awsappsync/resources/dynamodb/AmazonDynamoDBCFTemplate.yaml \
--capabilities CAPABILITY_NAMED_IAM
Sau khi chạy câu lệnh này một bảng AppSyncTutorial-Post được tạo
Nhập AWSAppSyncTutorial
cho tên của Model
Ấn Remove field để loại bỏ các trường không cần thiết
Ấn Create
Nhập tên cho API, ví dụ AWSAppSyncTutorial
Ấn Create
Sau khi tạo xong, chọn tab Schema ở menu phía bên trái
schema {
query: Query
mutation: Mutation
}
type Query {
getPost(id: ID): Post
}
type Mutation {
addPost(
id: ID!
author: String!
title: String!
content: String!
url: String!
): Post!
}
type Post {
id: ID!
author: String
title: String
content: String
url: String
ups: Int!
downs: Int!
version: Int!
}
PostDynamoDBTable