AWS Lambda
For this demo is necessary:
- AWS account: Choose Create an AWS Account, or Complete Sign Up.
- AWS CLI: The AWS Command Line Interface (AWS CLI) is an open source tool that enables you to interact with AWS services using commands in your command-line shell.
-
In AWS Web, click in your user > My Security Credentials:
-
In console, write "aws configure" command and add the id and secret of aws web, select your region and preferred output format. If you want to create a specific configuration profile use: "aws configure --profile <profileName>":
-
Write the following command to clone this repository in the dir that you want:
git clone https://github.com/codeurjc-students/2019-ServerlessVsSpring.git
-
From the console, navigate to the folder "sections/USERS-MANAGEMENT-AWS-Spring/source/aws-cognito".
-
Create an AWS S3 bucket to storage the application.
To create the bucket, use this command:
aws s3api create-bucket --bucket usermanagement-spring-aws --region eu-west-1 --create-bucket-configuration LocationConstraint=eu-west-1
-
Go to Permissions > Bucket Policy and paste this and save:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "Allow Public Access to All Objects", "Effect": "Allow", "Principal": "*", "Action": "s3:*", "Resource": "arn:aws:s3:::usermanagement-spring-aws/*" } ] }
how can you see here in another example:
-
We need to package our SAM applicaction. Execute this command in aws-lambda folder:
aws s3 sync . s3://usermanagement-spring-aws --region eu-west-1
-
Go to Properties > Static website hosting > check Use this bucket to host a website and write
home.htm
in both fields and save: -
Create User Pool: Go to Cognito > Create User Pool > Review defaults
-
Add an App: Select Add app client... > Add app client
-
Fill with a name and uncheck
Generate client secret
field and press Create app client then, Create Pool: -
Modify config.js like this and reupload it:
-
Go to the endpoint of the web site (your yellow box in step 6)
-
When you are inside the website, select SIGN UP NOW
-
Fill the fields and press SIGNUP
-
We will receive an email with a confirmation code. Since the mail is false, we will confirm ourselves: Go here, select the user and press "Confirm user".
-
Now we can login:
and see the greeting:
Spring Security
For this demo is necessary: