amazon-archives / aws-cognito-angular-quickstart

An Angular(v5)-based QuickStart single-page app utilizing Amazon Cognito, S3, and DynamoDB (Serverless architecture)
https://cognito.budilov.com
Apache License 2.0
689 stars 304 forks source link

Enable custom service endpoints for sample application #87

Closed whummer closed 7 years ago

whummer commented 7 years ago

This PR enables configuration of custom service endpoints.

Specifying custom endpoints in the AWS SDK is an extremely useful feature for testing. The main motivation for this change is to make the sample application work with LocalStack (a local AWS testing/mocking service).

In particular, this change enables: 1) using a custom CLI command (awslocal instead of aws) 2) using local service endpoints instead of the AWS production endpoints

The application can be initialized using the awslocal CLI (https://github.com/localstack/awscli-local) to use the local service endpoints:

$ pip install awscli-local
$ cd aws; aws_cmd=awslocal ./createResources.sh

Note that this is a non-breaking change that fully maintains backwards compatibility. The $aws_cmd variable defaults to aws, and by default the application still uses the production AWS services.

whummer commented 7 years ago

@vbudilov @dpantke Is this PR being considered, any chance we can get this merged? Thanks!

vbudilov commented 7 years ago

Hi @whummer,

Thanks for the PR! I'm reviewing it now and will get back to you soon.

Vladimir

vbudilov commented 7 years ago

Hi @whummer ,

I've done a bit of digging and think that instead of a code PR it would be beneficial for our users to add an additional section to the README file to describe ways to test this app locally. There are many such frameworks. I want devs to know what options they have, with LocalStack being one of them.

So you can create a "Local Testing" header, with a "LocalStack" subsection underneath. How does that sound?

whummer commented 7 years ago

Thanks for the feedback @vbudilov , really appreciated! The README has been updated with instructions for local testing, as per your suggestion.

I still believe that the ability to specify target endpoints is highly valuable for the users. You are right that there are different frameworks for local testing (LocalStack being one of them), but they all equally benefit from the ability to customize the service endpoints. I've made sure in the PR that the changes are as generic as possible, but if you feel that the code could be improved, I'd be happy to follow up with changes to accommodate any specific concerns. Thanks again.