当前位置: 首页 > 软件库 > 云计算 > Serverless 系统 >

aws-cognito-angular-quickstart

授权协议 Apache-2.0 License
开发语言 JavaScript
所属分类 云计算、 Serverless 系统
软件类型 开源软件
地区 不详
投 递 者 轩辕弘雅
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Cognito Quickstart

Creator: Vladimir Budilov

Note: This repo is deprecated. It was created before the Amplify SDK was available which performs a lot of the plumbing for you. Please use the Amplify SDK going forward. Here's an example of its use with ReactJS as well.

What does this app do?

Tech Stack

Required Tools

Frameworks

AWS Setup

Install the required tools (the installation script only runs on Linux and Mac)

Getting the code and running it locally

This uses the pre-configured AWS resources hosted by AWS

# Clone it from github
git clone --depth 1 git@github.com:awslabs/aws-cognito-angular2-quickstart.git
# Install the NPM packages
cd aws-cognito-angular2-quickstart
npm install
# Run the app in dev mode
npm start

Creating AWS Resources

This sample application can be deployed to either Elastic Beanstalk or S3. S3 will host this application as a static sitewhile Elastic Beanstalk gives you the capability of adding backend operations to the application.

createResources.sh requires your aws cli to be configured for JSON output.

# Install the AWS resources and deploy your application to either Elastic Beanstalk or S3
cd aws
./createResources.sh

Running the above command will create the necessary AWS resources and build & deploy your code to AWS.It will prompt you to choose your deployment target (S3 or Elastic Beanstalk). Choosing 'S3' makes your deploymentcompletely serverless, while choosing Elastic Beanstalk will create an EC2 instance that will host this NodeJS app.

Caution: You might incur AWS charges after running the setup script

After initially running the createResources.sh script, use the below commands to rebuild and redeploy

S3: Update, Build and Deploy

# Build the project and sync the output with the S3 bucket
npm run build; cd dist; aws s3 sync . s3://[BUCKET_NAME]/
# Test your deployed application
curl –I http://[BUCKET_NAME].s3-website-[REGION].amazonaws.com/

NOTE: You might want to reshuffle some of the "package.json" dependencies and move the ones that belong to devDependenciesfor a leaner deployment bundle. At this point of time, AWS Beanstalk requires all of the dependencies,including the devDependencies to be under the dependencies section. But if you're not using Beanstalk then you canoptimize as you wish.

or

Beanstalk: Update, Build and Deploy

# Commit your changes in order to deploy it to your environment
git add .
git commit
eb deploy
# View your deployed application in a browser
eb open

Local Testing

This section contains instructions on how to test the application locally (using mocked services instead of the real AWS services).

LocalStack

To test this application using LocalStack, you can use the awslocal CLI (https://github.com/localstack/awscli-local).

pip install awscli-local

Simply parameterize the ./createResources.sh installation script with aws_cmd=awslocal:

cd aws; aws_cmd=awslocal ./createResources.sh

Once the code is deployed to the local S3 server, the application is accessible via http://localhost:4572/cognitosample-localapp/index.html (Assuming "localapp" has been chosen as resource name in the previous step)

 相关资料
  • 我是不是错过了一些简单的东西?

  • 我正在努力集成一个应用程序的登录屏幕,我正在努力用AWS Cognito创建这个应用程序,并且一直按照逐步说明与服务器连接。 第5步(共7步)复制Mobile Hub Helper和自定义代码 将下载的代码中的src/main/java/com/amazonaws文件夹复制到Android Studio项目的java/com文件夹中。 此文件夹包含一组为您自定义生成的帮助器类。这些是根据您的项目配

  • 如何用Cognito调用带有邮递员的API网关? 谢谢

  • 我尝试使用AWS cognito注册android应用程序。但是,每当我这样做时,它都显示: 注册失败-检测到1个验证错误:值null在userattributes.1.member.name未能满足约束:成员不得为null 如何解决这个问题? AWS中此错误消息的来源在哪里?

  • 根据文档,我了解了如何创建物联网,以及如何使用AWS物联网创建经过身份验证的用户。我的问题是如何有效地组合这些服务,以便每个用户都可以安全地访问他或她的多个设备。 假设Jane刚刚注册了该平台,并希望将她的灯泡设备连接到她的帐户。我们还假设她的灯泡设备上已经有证书和物联网中的策略,以便它可以连接到物联网平台,然后发布和订阅一些主题。为了简单起见,假设Jane可以通过简单地进行名为的API调用来创建

  • 背景:显然,我对cognito了解不多,因为我花了两个小时试图用cognito对我的用户进行身份验证,并意识到他们不是身份验证提供者,而是凭证的组织者。然后我想到了一个更简单的解决方法,而不是创建一个全新的后端来验证用户和证书希望验证其可行性。 计划:我在想,我会让用户进入我的应用程序,并以未经身份验证的用户身份自动通过Cognito的身份验证。然后我将使用对AWS Lambda和Dynamodb