My understanding is that when creating objects annotated with #model in GraphQL API, DynamoDB table is created and configured automatically. How to access this table? I cannot see it in the DynamoDB console.
They should be there. Make sure you are in the same region as your Amplify application. So for example, if you provisioned your Amplify app in us-east-2, your DynamoDB tables will also be in us-east-2.
Related
Is there any way to manage an Azure Cosmos DB collection with partition key that uses the Mongo API directly from c#?
Currently we use Terraform to provision the Cosmos DB account and the database and we use the MongoDB.Driver to administrate collections. To get the Collection (and create it if it does not exist), we use the following syntax:
public IMongoCollection<MyDocument> MyDocumentsCollection =>
Database.GetCollection<MyDocument>("MyDocuments", mongoCollectionSetting);
I do not see any option to set the partition key for the collection and I was expecting to accomplish this with the mongoCollectionSettings. What is the best option to get this working?
I have found the Microsoft.Azure.Cosmos SDK but this is only applicable for Cosmos DB's SQL API.
Also I don't want to start with the method RunCommand but I guess this is the only option...?! Is it?
How to copy data, one collection, from one Cosmos DB API for MongoDB account to another Cosmos DB API for MongoDB account, in another subscription, placed in another Azure region.
Preferably do it periodically.
You can use Azure Data Factory to easily copy a collection from one Cosmos DB API for MongoDB account to another Cosmos DB API for MongoDB account, in any other subscription, placed in any other Azure region simply using Azure Portal.
You need to deploy some required components like Linked Services, Datasets and Pipeline with Copy data activity in order to accomplish this task.
Use Azure Cosmos DB (MongoDB API) Linked Service to connect the Azure Data Factory with your Cosmos DB Mongo API account. Refer Create a linked service to Azure Cosmos DB's API for MongoDB using UI for more details and step to deploy.
Note: You need to deploy two Azure Cosmos DB (MongoDB API) Linked Service, one for source account from where you need to copy the collection, and another for destination account where the data will be copied.
Create Datasets by using Linked service created in above step. Your dataset will connect you to the collection. Again you need to deploy two datasets, one for source collection and another for destination collection. It will look like as shown below.
Now create a pipeline using Copy data activity
In Source and Sink tab in copy data activity settings, select the source dataset and sink dataset respectively which you have created in step 2.
Now just Publish the changes and click on Debug option to run the pipeline once. The pipeline will run and collection will be copied at destination.
If you want to run the pipeline periodically, you can create Trigger based on event or any specific time. Check Create a trigger that runs a pipeline on a schedule for more details.
I am using AWS Amplify to build a Web Application. I am using Appsync and DynamoDb and I've defined my GraphQL schema. Now, Amplify offers the ability to test local GraphQL endpoints by running "amplify mock api" from the command line. I did this and it successfully created some local GraphQL endpoints for me and I was able to insert some data and do some local queries. (When I ran "amplify mock api" the first time I got some messages on the console that my tables were created.)
I have since made quite significant changes to my GraphQL schema, including keys, sorting keys, etc. I don't think all of my changes successfully got applied to my local api and database tables. So I just basically want to completely delete my local "database" so that "amplify mock api" can regenerate a new local database for me based on my new schema. How do I do this? I don't know where this amplify local database resides or what underlying technology it uses. (Otherwise I would just connect directly to the database and drop all tables to force a recreation.) I have tried "amplify remove api" which removed the local endpoints. I even pushed this to AWS (I am in development mode currently, so I didn't mind destroying my AWS environment.) I then did "amplify add api" again from scratch and I typed out my schema again. But if I run "amplify mock api" then it doesn't recreate the tables. The endpoint starts up and if I perform a GraphQL query I get the data back that I originally added. Which means those tables persist.
How can I completely drop my local "mock" Amplify Appsync GraphQL endpoints and database to force a recreate? (I am using a Mac, if it's relevant).
It ended up being very simple. Amplify creates the mock data in ./amplify/mock-data. So to delete the database and recreate it I just deleted this directory in my project. This question was helpful in working out how the mock API and database setup works.
I have a DynamoDB connected to step functions and I am building a UI to display changes. I connected the DB to an AppSync instance and have tried using subscriptions through AppSync, but it seems they only observe mutations within the current AppSync.
How can I subscribe to the data source changes directly?
You are correct. Currently, AppSync Subscriptions are only triggered from GraphQL Mutations. If there are changes made to the DynamoDB from a source other than AppSync, subscriptions will not trigger.
If you want to track all changes being made to DynamoDB table and publish them using AppSync, you can do the following:
1) Setup a DynamoDB stream to capture changes and feed the changes to AWS Lambda
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.html
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.Lambda.html
2) Setup an AppSync mutation with a Local (no datasource) resolver. You can use this to publish messages to subscribers without writing to a datasource.
https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-local-resolvers.html
3) Make the DynamoDB Stream Lambda function (setup in step 1) call the AWS AppSync mutation (setup in step 2).
This will enable publishing ALL changes made to a DynamoDB table to AppSync subscribers, regardless of where the change came from.
I have an existing CosmosDB Account which was originally set up for the SQL api. I would like to create a graph but keep/manage it under the same database account.
I would like to use the Gremlin.Net sdk which (if I understand properly) requires the 'https://my-account.gremlin.cosmosdb.azure.com:443/' endpoint. Do all collections have this endpoint, or only collections created with an account targeting the gremlin api?
A better way of doing this would be
Create a new Graph account ( this will create the required gremlin server endpoint)
Migrate existing data using graph bulk executor.
Jayanta