Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 142cd9b

Browse files
justonianmikedeck
authored andcommitted
Integrating new re:Invent 2018 Auth workshop (#169)
* Added folder structure and website * Added initial project readme * Added aws-exports file template * Added Cognito User Pool setup flow screenshots * Added Cognito User Pool setup to Auth Module 1 * Adding Amplify integration steps to Module 1 * Adding Serverless API CloudFormation template * Re-factored to using amplify config file * Adding Amplify config for API Gateway * Updated Serverless API CloudFormation template * Updated architecture diagrams * Added API integration code for module 2 * Updated Readme API integration instructions * Expanded Amplify config to include S3 storage * Added user profile page * Added index links to new profile page * Securing private profile route * Updated Readmes to cross-reference modules * Fixed broken link * Updated broken reference * Updated Module 2 Readme * Updated Module 1 Readme * Refined token state handling * Added Module 3 readme and Profile page * Updated master readme * Updated Cloud9 Setup Instructions * Updating README instructions * Added managed API Gateway invocation IAM policy * Updated Readme with regional links to Cloud9 CF template * Updated Readmes to launch CF stacks directly via regional links * Updated all source file paths to include website folder reference * Moved prerequisites and workshop setup to Module 0 * Modified the instructions so that the hyperlink to the next module is a top level instruction rather than embedded in the details drop down * Refined Cognito User Pools setup instructions and READMEs * Removed MFA from workflow * Adding explicit mention to save Amplify config file changes * Adding initial cleanup module * Refined READMEs for Modules 0-2 * Refined Module 3 instructions * Expanded API Gateway configuration instructions * Modified getting started steps and added background information about the modules * updated pricing and steps in getting started to notify users about nested Cloud9 template * Updated instructions for getting started and main readme, including pricing clarifications * Updated Instructions to fix numbering issue in Module 1 - Authentication. Also add extra image to step 3.7 * Updated numbering in the README files to fix some numbering issues * Fixed link to next module * Updated README with links to server pages * update cleanup instructions with CLI and images * add in describe calls to find resources * remove pricing section * Updated main readme page to reference Auth workshop * Added successful authorizer test notification * Updated reference resources * Refined modules 0, 1, and 9 instructions * Refined styling consistency across modules * Refined lab instructions styling for consistency * Updating git clone command to point to testing repo * Updated cognito-userpool-setup-step4.png to incorporate console changes into instructions * Adding IAM optional extension to module 2 * remove project costs from project overview readme * fixed bug in amplify-config.js where there was an extra comma breaking the json * Added the word EXAMPLE in the amplify-config.js file to make it easier to read the comments in the file * remove reference to mfa in module 1 section 5.6 since the MFA has been removed from module * updated cloudformation links to exclude regions that do not have Cloud9 available since users will not likely manage cross-region resources in this workshop. * instructions update to clarify how to copy the region code in module 3 section 1.6 * updated Getting Started instructions to remove cloudformation launch buttons for regions that dont have cloud9 * Updated Amplify config with API Gateway region setting and added CORS headers to API 4xx and 5xx responses * Updatd IAM policy for API Gateway in backend template * Updated CloudFormation region table links * Updated default method signatures to async pattern * Refined Module 1 instructions * Added context on signUp and signIn methods * Updating Git Clone command to final workshop repo * Refined module 1 guide * Refined module 2 instructions * Refined module 2 instructions * Refined module 3 instructions * Updated API Gateway Gateway Reponse to return default CORS headers * Refined modules 2 and 3 workshop instructions * Integrating Readme links
1 parent 559f1a0 commit 142cd9b

File tree

140 files changed

+30147
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+30147
-3
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
AWSTemplateFormatVersion: 2010-09-09
3+
Description: VPC Infrastructure setup and deployment of Cloud9 IDE for SRV306 AWS Re:Invent Workshop 2018
4+
Resources:
5+
# Create the Cloud9 Instance in a specified Subnet
6+
Cloud9Instance:
7+
Type: "AWS::Cloud9::EnvironmentEC2"
8+
Properties:
9+
Description: "Cloud9 IDE for the SRV306 Serverless Authentication and Authorization Workshop at AWS Re:Invent 2018"
10+
AutomaticStopTimeMinutes: 60
11+
InstanceType: t2.micro
12+
Name: !Sub ${AWS::StackName}-Cloud9Instance
13+
SubnetId: !Ref PublicSubnet1
14+
DependsOn: GatewayToInternet
15+
16+
# Create the VPC infrastructure
17+
Vpc:
18+
Type: AWS::EC2::VPC
19+
Properties:
20+
CidrBlock: 172.20.0.0/16
21+
EnableDnsHostnames: true
22+
Tags:
23+
- Key: Name
24+
Value: !Sub "${AWS::StackName}-VPC"
25+
26+
PublicSubnet1:
27+
Type: AWS::EC2::Subnet
28+
Properties:
29+
VpcId: !Ref Vpc
30+
AvailabilityZone: !Select [ 0, !GetAZs '' ]
31+
CidrBlock: 172.20.1.0/24
32+
Tags:
33+
- Key: Name
34+
Value: !Sub "${AWS::StackName}-PublicSubnet1"
35+
36+
InternetGateway:
37+
Type: AWS::EC2::InternetGateway
38+
Properties:
39+
Tags:
40+
- Key: Name
41+
Value: !Sub "${AWS::StackName}-InternetGateway"
42+
43+
GatewayToInternet:
44+
Type: AWS::EC2::VPCGatewayAttachment
45+
Properties:
46+
VpcId: !Ref Vpc
47+
InternetGatewayId: !Ref InternetGateway
48+
49+
PublicRouteTable:
50+
Type: AWS::EC2::RouteTable
51+
Properties:
52+
VpcId: !Ref Vpc
53+
Tags:
54+
- Key: Name
55+
Value: !Sub "${AWS::StackName}-InternetGateway"
56+
57+
PublicRoute:
58+
Properties:
59+
RouteTableId: !Ref PublicRouteTable
60+
DestinationCidrBlock: 0.0.0.0/0
61+
GatewayId: !Ref InternetGateway
62+
Type: AWS::EC2::Route
63+
64+
PubSubnet1RTAssoc:
65+
Properties:
66+
SubnetId: !Ref PublicSubnet1
67+
RouteTableId: !Ref PublicRouteTable
68+
Type: AWS::EC2::SubnetRouteTableAssociation
69+
70+
Outputs:
71+
Cloud9IDE:
72+
Value:
73+
!Join ["",["https://",!Ref "AWS::Region",".console.aws.amazon.com/cloud9/ide/",!Ref Cloud9Instance,"?region=",!Ref "AWS::Region"]]
74+
Vpc:
75+
Description: Vpc for Cloud9 instance
76+
Value: !Ref Vpc
77+
Export:
78+
Name: !Sub ${AWS::StackName}-Vpc
79+
PublicSubnet1:
80+
Description: Public Subnet for Cloud9 Instance
81+
Value: !Ref PublicSubnet1
82+
Export:
83+
Name: !Sub ${AWS::StackName}-PublicSubnet1

Auth/0_GettingStarted/README.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Getting Started: Workshop Prerequisites and Setup
2+
3+
This section outlines the prerequisites to complete the workshop and instructions for launching a Cloud9 IDE environment that you will use throughout the workshop.
4+
5+
## Prerequisites
6+
7+
### AWS Account
8+
9+
In order to complete this workshop, you'll need an AWS account and access to create and manage the AWS resources that are used in this workshop, including Cloud9, Cognito, API Gateway, Lambda, DynamoDB, and IAM policies and roles.
10+
11+
The code and instructions in this workshop assume only one participant is using a given AWS account at a time. If you attempt sharing an account with another participant, you may encounter naming conflicts for certain resources. You can work around this by using distinct Regions, but the instructions do not provide details on the changes required to make this work.
12+
13+
Please make sure not to use a production AWS environment or account for this workshop. It is recommended to instead use a development account which provides full access to the necessary services so that you do not run into permissions issues.
14+
15+
### Region Selection
16+
17+
Use a single region for the entirety of this workshop. This workshop supports three regions in North America, three regions in Europe, and three in Asia Pacific. Choose one region from the launch stack links below and continue to use that region for all of the Auth workshop activities.
18+
19+
### AWS Cloud9 IDE
20+
21+
[AWS Cloud9](https://aws.amazon.com/cloud9/) is a cloud-based integrated development environment (IDE) that lets
22+
you write, run, and debug your code with just a browser. It includes a code
23+
editor, debugger, and terminal. Cloud9 comes pre-packaged with essential tools
24+
for popular programming languages and the AWS Command Line Interface (CLI)
25+
pre-installed so you don’t need to install files or configure your laptop for
26+
this workshop.
27+
28+
## Cloud9 IDE Setup
29+
30+
In this section you will launch a CloudFormation stack that will create a a new [Amazon VPC](https://aws.amazon.com/vpc/) environment and a [Cloud9 IDE](https://aws.amazon.com/cloud9/) Instance that you will use in the rest of the workshop.
31+
32+
Region Name | Region Code | Launch
33+
------|-----|-----
34+
US East (N. Virginia) | us-east-1 | [![Launch Cloud9 in us-east-1](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/cloudformation-launch-stack-button.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=WildRydes-Cloud9&templateURL=https://s3.amazonaws.com/wildrydes-us-east-1/Auth/0_GettingStarted/Cloud9WithNewVPC.yaml)
35+
US East (Ohio) | us-east-2 | [![Launch Cloud9 in us-east-2](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/cloudformation-launch-stack-button.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/new?stackName=WildRydes-Cloud9&templateURL=https://s3.amazonaws.com/wildrydes-us-east-2/Auth/0_GettingStarted/Cloud9WithNewVPC.yaml)
36+
US West (Oregon) | us-west-2 | [![Launch Cloud9 in us-west-2](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/cloudformation-launch-stack-button.png)](https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/new?stackName=WildRydes-Cloud9&templateURL=https://s3.amazonaws.com/wildrydes-us-west-2/Auth/0_GettingStarted/Cloud9WithNewVPC.yaml)
37+
EU (Ireland) | eu-west-1 | [![Launch Cloud9 in eu-west-1](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/cloudformation-launch-stack-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/new?stackName=WildRydes-Cloud9&templateURL=https://s3.amazonaws.com/wildrydes-eu-west-1/Auth/0_GettingStarted/Cloud9WithNewVPC.yaml)
38+
Asia Pacific (Singapore) | ap-southeast-1 | [![Launch Cloud9 in ap-southeast-1](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/cloudformation-launch-stack-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-1#/stacks/new?stackName=WildRydes-Cloud9&templateURL=https://s3.amazonaws.com/wildrydes-ap-southeast-1/Auth/0_GettingStarted/Cloud9WithNewVPC.yaml)
39+
40+
<details>
41+
<summary><strong>Step-by-step instructions (expand for details)</strong></summary><p>
42+
43+
1. Launch the CloudFormation stack from the links above, choosing the link appropriate for the region you selected for this workshop.
44+
45+
1. On the next screen, Step 2, confirm the stack name is `WildRydes-Cloud9` and click **Next**.
46+
47+
1. On the Configure Stack Options page, accept all the defaults and click **Next**.
48+
49+
1. On the Review page, review the summary details then click **Create stack**.
50+
51+
1. It will take a few minutes for the Stack to create. Choose the **Stack Info** tab to go to the overall stack status page and wait until the stack is fully launched and shows a status of *CREATE_COMPLETE*. Click the refresh icon periodically to see progress update.
52+
53+
1. With the *WildRydes-Cloud9* stack selected, click on the **Outputs** tab and copy the value shown for the *Cloud9IDE* to the clipboard. Browse to that URL in a new browser tab to load your IDE environment.
54+
55+
> Note: When you launch the stack, CloudFormation deploys a nested CloudFormation stack to launch the Cloud9 resources. You can safely ignore that template which is prefixed with "aws-cloud9-WildRydes-".
56+
57+
![CloudFormation Outputs open Cloud9](../images/cloud9_cfn_outputs.png)
58+
59+
</p></details>
60+
61+
Once you have launched and navigated to your Cloud9 workspace URL shown in your CloudFormation stack outputs, you should have an IDE environment as shown below:
62+
63+
![Cloud9 Initial Welcome Screen](../images/cloud9_initial_screen.png)
64+
65+
You can run AWS CLI commands in here just like you would on your local computer. Verify that your user is logged in by running the following:
66+
67+
```
68+
aws sts get-caller-identity
69+
```
70+
71+
You should see output indicating your account and user information:
72+
73+
```
74+
{
75+
"Account": "123456789012",
76+
"UserId": "AKIAI44QH8DHBEXAMPLE",
77+
"Arn": "arn:aws:iam::123456789012:user/Alice"
78+
}
79+
```
80+
81+
Keep your AWS Cloud9 IDE opened in a tab throughout this workshop as you'll be using it for most all activities.
82+
83+
### Download Workshop Code
84+
85+
1. Switch to the tab where you have your Cloud9 IDE opened.
86+
87+
1. Clone the workshop repository to your IDE environment by running the following command in the Cloud9 terminal window:
88+
89+
```console
90+
git clone https://github.com/aws-samples/aws-serverless-workshops.git
91+
```
92+
93+
### Initialize your developer workspace
94+
95+
1. Run the following commands to upgrade your Node.js version to the latest version of Node.js 8. The [AWS Amplify](https://aws-amplify.github.io/) JavaScript library which we will be using requires Node.js 8 or higher.
96+
97+
```console
98+
nvm i 8
99+
nvm alias default 8
100+
```
101+
102+
2. Install the yarn package manager and website dependencies by running the following commands
103+
104+
```console
105+
npm install -g yarn
106+
cd ~/environment/aws-serverless-workshops/Auth/website/
107+
yarn install
108+
```
109+
110+
### Tips
111+
112+
:bulb: Keep an open scratch pad in Cloud9 or a text editor on your local computer
113+
for notes. When the step-by-step directions tell you to note something such as
114+
an ID or Amazon Resource Name (ARN), copy and paste that into the scratch pad tab.
115+
116+
### Recap
117+
118+
* Use a unique personal or development AWS Account where you have permissions to create resources and create IAM policies and roles
119+
* Use a single, consistent region throughout all modules of this Auth workshop
120+
* Keep your [AWS Cloud9 IDE](#aws-cloud9-ide) opened in a tab at all times
121+
122+
### Next
123+
124+
Once you have your Cloud9 workspace fully working, proceed back to the main workshop page to review the workshop steps and begin - [Next Steps](../README.md).

0 commit comments

Comments
 (0)