Use an existing DynamoDB datasource with Amplify and AppSync - aws-cloudformation

I have a working app I made using Amplify (with AppSync API and Cognito). I'd like to make another app which is different, but shares some data with my first project (same product, but different targets, usages and security rules).
Is there a clean way to use Amplify for that new project, telling the GraphQL API to fetch some data in the DynamoDB from my first Amplify project ?
This data will change often and will be heavy - so I'm not too much into any synchronization solution.
I thought about those solutions, but I'm not experienced enough to tell if one of them is good:
Not using Amplify but SAM for this new project (but I will lose all the build pipeline provided by Amplify)
Using Amplify for the Hosting and the Auth, but configure AppSync with SAM and plug it into my existing DataSource
Maybe CloudFormation can be the answer, but I don't see how to interact directly with it within Amplify

There is an article from Amazon about microservice architectures that might be useful for you
https://aws.amazon.com/blogs/mobile/appsync-microservices/
I'm not sure if Amplify supports adding multiple APIs to it, if so, you could add it and then pull only that api on it.
IMO the easiest approach would be just creating a query endpoint to fetch the data from your other datasource, using lambda.
So, in that case you would edit your schema to something like this
query
{
externalData [ExternalData] #function(name: "getExternalData")
}
Then you need to add the lambda function getExternalData, which will be responsible to query the data as needed.
The article above has more in-depth details about this architecture

Related

A real-time chat with admin in flutter

commerce app but I need to create a chat just between every user and admin like for problems and etc so anyone has an idea on how it can be done
I've been using AWS services for something similar. The quickest way around it is to use AWS Amplify (think of it as AWS's Firebase).
Here's an article describing how you can build a chat application with Amplify: https://aws.amazon.com/blogs/mobile/building-a-serverless-real-time-chat-application-with-aws-appsync/. Note that this article is from 2018, and it mentions AWS Mobile - which was replaced by AWS Amplify.
The example is for React, but you can easily build your Flutter front end for it. I'd recommend for now using this package, since it supports all the platforms(Android, iOS, Web): https://pub.dev/packages/amazon_cognito_identity_dart_2
If you need only Android and iOS at the moment (and you can wait for the web support), you can also try the official AWS Amplify Flutter: https://pub.dev/packages/amplify_flutter
In any case - you will need some sort of web socket based solution. GraphQL is I think the right way to go (AWS Amplify uses service called AWS Appsync - which is just their implementation of GraphQL).
I think this is a really general question, but I will share my little knowledge about the matter.
Well apart of implementing your own solution, with your own backend and/or websockets, you can also use Firebase to achieve it.
There are some services like getStream that provide some good packages, and all the main functionalities required from a chat, and also UI widgets for it. Of course, is not free.

Query Azure database using API

I host my database on Azure. I would like to search data on the table in that database. I am trying to use B4I and the tech help their said I need to use REST API's. I am pretty sure I need to use ODATA. I have the auth token but I am not sure if this is even possible.
In order to query Azure SQL with an API you need to add a layer between it and the destination. As mentioned in this question, OData is a specification that can be implemented fairly easily as there are plenty of libraries that will take care of the bulk of the code for you.
As far as where to host the API, you have several options within Azure. The most common being App Services, Azure Functions, and Logic Apps.

can I add custom nested CloudFormation stack to AWS Amplify OR can I create a custom Lambda function/SQS with GraphQL/AppSync?

Spending more than a day I doubt the answer is Yes.
Want to double check though.
Creating Lambda functions is possible with REST APIs. But I need it with GraphQL. As I understand, currently creating Lambda function from CLI for GraphQl is not supported - right ?
In my app one party places an order => mutates DynamoDB table Orders => DynamoDB triggers a Lambda function that in turn mutates DynamoDB table Offers (changes offer's status). This change should notify subscribed parties.
I could do it in a separate Lambda function or in a Lambda function that serves as a Resolver. But either way I do not see a way of doing it using AWS Amplify.
Resolver Lambda function should also be manually added in console (providing Lambda ARN). Is there a way of adding it using CLI or config files or nesting a CloudFormation stack template ?
I know I can do all manually in console. But I need to find a way using AWS Amplify so that I have a parent and nested CloudFormation stack templates.
Possible workaround I see is:
setting up GraphQL API using AWS Amplify;
setting up rest of the serverless environment with AWS SAM or Serverless Framework;
have to manually connect (in console) Lambda and SQS with AppSync's DynamoDB.
Is my understanding correct? Is there a better way than this workaround ?
I am building my front end app in React. This AWS Amplify page shows how resources such as SQS can be created for iOS. Is there anything similar for React ?
Thank you

Integrating external objects into SF without Salesforce or Lightning connect (from Postgres tables)

I have some tables from Postgres database to be integrated into Salesforce as external objects. I went through some video tutorials and documentations where I was recommended to use Salesforce Connect which supports providers with "OData" protocol support. Is it possible to integrate Postgres tables into Salesforce as external objects without Salesforce Connect?
Thanks.
Be careful with the phrase "external objects". To me, the use of those particular words implies the specific implementation of external data access/federation delivered with Salesforce Connect. I don't believe that there is any alternative if your goal is to create "real" external objects (named "objectname__x") within Salesforce.
There are, though, Salesforce integration solutions from the likes of Progress, Jitterbit, Mulesoft, and Informatica and others that can be used to access PostgreSQL, with varying degrees of coding being required. You won't get "external objects", but you will be able to access data residing off-cloud in a PostgreSQL database from your Salesforce system.
Hope this helps.
Currently the way to integrate data from external storages (Postgres in your case) without Salesforce Connect is implement your custom logic for synchronization using REST or SOAP API, Apex classes and triggers, Salesforce Workflows and Flows. Also you will need to implement appropriate interfaces on side of your data storage. Complexity of all these steps depends on complexity of your existing data model and infrastructure around it.

how do i create database using entity

I followed very simple example from www.asp.net to create Web API project using Empty project template for Web API. This tutorial does not create database instead it just create model class and seed data inside api controller.
I successfully consumed API controller using angular service and able to show data on UI. Till here everything is fine.
However, moving one step further i would like create database but not sure about the steps.
I don't want to follow some other tutorial available on same site which does all of these things because i am not understand the overall concept even though i'll able to create database. Also, tutorial talks about using MVC approach which i dont want to use. I just looking for Web API, EF and Angular combination.
Can someone guide me for writing context class and overall database creation steps.?