Closed anikethchavare closed 3 years ago
Hi @Anikethc, thanks for the feedback.
Amplify provides a few different high-level interfaces to DynamoDB. If you are new to them, you should start with Amplify DataStore (preferred mechanism).
Amplify GraphQL API and Amplify REST API can also be used, if do not need the data when your app is disconnected from the Internet.
Each of these approaches combine several AWS backend services (Cognito, AppSync, API Gateway, DynamoDB, Lambda) to create secure end-to-end data management systems.
It is generally considered bad practice for a mobile device to talk directly to a database, as you propose. I'd suggest reading some of these discussions for more background on that: Why can't I just let customers connect directly to my database?, Why use API Gateway as a proxy for AWS APIs?.
In your section (2), you are correctly connecting Amplify categories to some of the AWS services that fulfill them. The Amplify categories also require Cognito or IAM, in addition to the services you've mentioned. A table mapping the categories to AWS services can be found here.
In (3), I note that you're having difficulty handling the scenario where a username may already exist in the system. On Discord, I suggested that you catch the exception being returned in the sign-up method, as below:
val options = AuthSignUpOptions.builder()
.userAttribute(AuthUserAttributeKey.email(), "my@email.com")
.build()
Amplify.Auth.signUp("username", "Password123", options,
{ Log.i("YourApp", "Sign-up succeeded.") },
{ error ->
if (error.getMessage().contains("what you're looking for")) {
displayMessageToUi("User, please take some action!");
}
}
)
Cognito also does have an admin API called GetUser
. You can use this to tell if a user exists. Although, there are security considerations to take into account, if you were to expose this API publicly to a mobile device. You would most likely want to call this API via a lambda, behind API Gateway.
There should be a easy way of integrating DynamoDB AWS to your android application.
When I search on the web, there are a lot of ways, most of which are very hard/painful. I have 2 issues. Can you please mention this as a feature request.
1)
I am trying to make a notes app which requires Login/Signup. I want to use DynamoDB for my app. I have multiple ways to implement this, but most of them are very hard. Some are:
1)
AWS Amplify -> AWS Amplify API -> AWS Amplify Lambda -> AWS DynamoDB
2)AWS Amplify -> AWS Amplify Auth -> AWS Cognito -> AWS Lambda -> AWS DynamoDB
When we run the
amplify add storage
, 2 options pop up:Content
andNoSQL Database
. That is a very good feature, but then we can't do any operations to the DynamoDB table later. There should be a feature in which we can do operations to our DynamoDB table right fromAmplify Storage
.When I start typing in
Amplify.Storage
in my java code, the attributes for S3 are given, but there should be a way for us to edit our table right that time. This will save everyone's time and work, and it will be easier for people to edit the table.A even better option is to directly connect DynamoDB with Android. Instead of relying on Amplify. This will become more easier for everyone. I tried implementing DynamoDB with my Android app but the app just crashes. There should be docs/tutorials only for Android and iOS.
2)
I think that AWS Amplify just makes everything harder. Here is the list of all the Amplify products you can merge to already existing AWS services/products:
1) Storage: You can merge this with AWS S3. 2) Authentication: You can merge this with Cognito. 3) DataStore: You can merge this with DynamoDB/DocumentDB. 4) Predictions: AWS Amplify predictions use these AWS Products.
Amazon Translate, Amazon Polly, Amazon Transcribe, Amazon Rekognition, Amazon Textract, and Amazon Comprehend
. You can create another AWS product called AWS Predictions which use all of these products. 5) API: You can merge theseGraphQL
&REST
API's to API Gateway. 6) Analytics: This uses these AWS servicesAmazon Pinpoint and Amazon Kinesis
. You can create another AWS products called AWS Analytics which use these services.3)
If the second issue is not possible, there is another issues I am facing.
I am working will AWS Amplify Auth (Cognito) and there are various methods to implement such as
SignUp
,Login
, etc.My problem is that I have a edittext with me and the users have to enter the phone number (username) to sign up. If the phone number (user) is not found in the user pool, it should let the user sign up. If the user is found in the pool, it should give a toast saying that
The User is Found
.There should be a method
CheckForUser
in which we just enter the username of the user and using that method, we can do more things such as if conditions for what do do if the user is found/not found in the user pool.This will make the developing process much easier instead of reading for the logs programmatically or checking what the logs contain.