LIST

AWS & Typescript Masterclass - 10. Using AWS inside a React project with Amplify

82-93 (82) Section intro introduce AWS Amplify in the browser Get temporary credentials in the Browser CORS issues App will be approaching it’s final form (83) Setup and Amplify install npm i aws-amplify @aws-amplify/auth npm i aws-sdk (84) Cognito login from React code model.ts import {CognitoUser} from '@aws-aplify/auth' export interface User { userName: string cognitoUser: CognitoUser } service/AuthService import {Auth} from "aws-amplify"; import Amplify from "aws-amplify"; import {CognitoUser} from "@aws-amplify/auth"; import {config} from "....

September 17, 2022

AWS & Typescript Masterclass - 15. other courses

Unit Testing for Typescript & NodeJs Developers with Jest https://www.udemy.com/course/unit-testing-typescript-nodejs Advanced Typescript programming with NodeJs and Webpack https://www.udemy.com/course/typescript-full-stack-programming Typescript with React classes - quick start - Jest testing https://www.udemy.com/course/typescript-with-react-jest-testing Mastering Visual Studio Code https://www.udemy.com/course/mastering-visual-studio-code Advanced Java programming with JavaFx: Write an email client https://www.udemy.com/course/advanced-programming-with-javafx-build-an-email-client Ubuntu Linux on VirtualBox quick setup https://www.udemy.com/course/ubuntu-linux-on-virtualbox-quick-setup Git with Visual Studio Code https://www.udemy.com/course/git-with-visual-studio-code

September 17, 2022

AWS & Typescript Masterclass - 9. Front-end for our back-end with React

62-81 (63) Create react app and git npx create-react-app space-finder-frontend --template typescript (64) Basic project structure folder structure components: ui components (*.tsx) model: types (*.ts) services: non-ui code (*.ts) util (*.ts) (65) state, props, child, parent change in state or props triggers re-render props are immutable state is mutable this.setState({ counterState: this.state.counterState + 1 }) use state / props this.state.counterState this.props.counterProp typescript class defines type of Props and State interface Props { counterProp: number } interface State { counterState: number } export class MyComponent extends React....

September 17, 2022

AWS & Typescript Masterclass - 11. Application Development

(Section 11 of Course_ AWS & Typescript Masterclass - CDK, Serverless, React) 94-97 (95) Deployment to S3 and Cloudfront // create bucket this.deploymentBucket = new Bucket( this.stack, 'space-app-web-id', { bucketName: bucketName, publicReadAccess: true, websiteIndexDocument: 'index.html' } ); new CfnOutput(this.stack, 'spaceFinderWebAppS3Url', { value: this.deploymentBucket.bucketWebsiteUrl }); // upload build folder to the bucket new BucketDeployment( this.stack, 'space-app-web-id-deployment', { destinationBucket: this.deploymentBucket, sources: [ Source.asset( join(__dirname, '..', '..', 'space-finder-frontend', 'build') ) ] } ); // cloudfront const cloudFront = new CloudFrontWebDistribution( this....

September 16, 2022

AWS Cognito - user pool vs identity pool

User pools stores user data basic authentication - JWT tokens -> authenticated - yes or no Identity pools fine grained access control - user assumes an identity can directly call AWS SDK commands User Pools (1) Get Auth Token User -> Cognito username password <- response– session object JWT token … (2) Get data User –> Secured API JWT token <-response– data Identity Pools (1) Get Auth Token User -> Cognito...

September 15, 2022

AWS & Typescript Masterclass - 7. Securing APIs with AWS Cognito

44-53 (44) Section intro cognito user pools JWT tokens groups (45) AWS Cognito AWS Cognito - user pool vs identity pool (46) Cognito in AWS console create user pool create app integration create app client command line force set password for user for dev aws cognito-idp admin-set-user-password --user-pool-id ${USER_POOL_ID} --username ${TEST_USER_NAME} --password "${TEST_USER_PASSWORD}" --permanent or with 1password cli op run -- bash -c 'aws cognito-idp admin-set-user-password --user-pool-id ${USER_POOL_ID} --username ${TEST_USER_NAME} --password "${TEST_USER_PASSWORD}" --permanent' (47) Generating JWT tokens with AWS Amplify (for dev within the playground)...

September 14, 2022

AWS & Typescript Masterclass - 8. AWS Cognito Identity pools

54-61 (54) Section intro AWS Cognito - user pool vs identity pool (55) AWS Cognito Identity pools in the console Authenticated role selection A) use default role authenticated unauthenticated B) choose role with rules ??? C) choose role from token (-> this app) user -> group -> role (56) Getting AWS temporary credentials // skipped (57-59) Identity pools in CDK link to userPoolGroup via roleArn new CfnUserPoolGroup(this.scope, 'admins', { groupName: 'admins', userPoolId: this....

September 14, 2022

AWS & Typescript Masterclass - 14. Typescript recap

100-123 (103) Types inferred type var a = 'hello' // inferred string explicit type var a:string = 'hello' // explicit string var arr: string[] = [] arr.push('hello') // ok arr.push(123) // nok ANY - last resort var a:any = 'hello' a = 3; //ok a = true //ok (104) User defined types objects have types functions have types interface interface Person { firstName: string, lastName: string, } type type job = string type specificJob = 'Engineer' | 'Programmer' combining types > found in AWS sdk...

September 12, 2022

AWS & Typescript Masterclass - 6. AWS DynamoDb with CDK and Lambda

32-43 (32) section intro (33) put item npm i @types/aws-lambda (34) getting data from ApiGateway const item = typeof event.body == 'object' ? event.body : JSON.parse(event.body) >? why this check for parsing? is this testing only, or is this random in prod? (35-36) DynamoDB + lambda // create table const table = new Table(this.stack, this.props.tableName, { partitionKey: { name: this.props.primaryKey, type: AttributeType.STRING, }, tableName: this.props.tableName }) // create lambda const id = `${this....

September 12, 2022

CDK commands

cdk commands cdk init app --language typescript cdk synth # create cloudformation files cdk bootstrap # create stack in cloudformation cdk deploy # synth + deploy cdk deploy [<stack-name>] cdk deploy --all cdk list cdk diff # cf terraform plan cdk destroy <stack-name> # cf terraform down https://docs.aws.amazon.com/cdk/api/v2/docs/aws-construct-library.html

September 12, 2022