Giter Club home page Giter Club logo

aws-bootcamp-cruddur-2023's Introduction

About Me

I'm Andrew Brown, I'm Canadian, dyslexic and a workaholic.

Free Cloud Certifications Video Courses

I create free cloud certification courses and I publish them to freeCodeCamp:

  • GCP-CDL (Google Cloud Digital Leader)
  • AZ-900 (Azure Fundementals)
  • AZ-104 (Azure Administrator)
  • SC-900 (Microsoft Security, Compliance, and Identity Fundamentals)
  • DP-900 (Azure Data Fundamentals)
  • AWS CFL-C01 (Certified Cloud Practitioner)
  • AWS SAA-C01 (Solutions Architect Associate)
  • AWS DVA-C01 (Developer Associate)
  • AWS SOA-C01 (SysOps Administrator Associate)
  • Hashicorp Terraform Associate
  • Kubernetes and Cloud Native Associate
  • and more!

The best way to support more free cloud certification courses is to purchase additional study material layered ontop of the free to watch video course at ExamPro

Cloud Career Advice Blog

I write long form articles cloud career advice on Hashnode blog at https://iamcloud.dev

I have a cloud career question

If you want to ask me cloud career question you can by sending me a DM on my twitter at @andrewbrown

Sometimes I send back a quick reply, if its a question that has been asked many times I'll prepare a long-form article.

100DaysOfCloud Community

I run the #100DaysOfCloud which both a cloud community for beginners and hashtag challenge.

Join the Discord

Twitter Spaces

I run twitter spaces where I bring on multiple speakers to cover a variety of cloud topics for begineers. Previous spaces I've hosted and organized:

  • Containers for Beginners
  • Kuberenetes for Beginners
  • Serverless for Beginners
  • DevOps for Begineers
  • Data Analytics for Beginners
  • AWS Amplify for Beginners
  • AWS CDK for Begineers
  • Cloud Project for Beginners
  • Accessibility and the Cloud
  • Getting Hired at AWS
  • Getting Hired at Microsoft / Azure
  • Getting Hired at Google Cloud
  • Getting Hired at VMWare
  • and many more

aws-bootcamp-cruddur-2023's People

Contributors

omenking avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-bootcamp-cruddur-2023's Issues

installing flask command missing on gitpod

Installing flask on GitPod environment is missing from the list of commands

cd backend-flask
export FRONTEND_URL=""
export BACKEND_URL="
"
#installing flask command missing
pip3 install -r requirements.txt
python3 -m flask run --host=0.0.0.0 --port=4567
cd ..

Updat lambda function with connection pool and Error handler

updat lambda function with connection pool and Error handler

import json
import psycopg2
from psycopg2 import pool
from urllib.parse import urlparse
import os
import sys


def lambda_handler(event, context):
    user = event['request']['userAttributes']
    print('userAttributes')
    print(user)
  
    user_display_name  = user['name']
    user_email         = user['email']
    user_handle        = user['preferred_username']
    user_cognito_id    = user['sub']

    params = [
        user_display_name,
        user_email,
        user_handle,
        user_cognito_id
    ]      
    
    print('entered-try')
    print(params)
    sql = return_string_sql(*params)

    conn = None
    conn = create_connection()
    execute_query(conn, sql, *params)

    if conn:
        conn.close()
        print('Database connection closed')

def create_connection():
    """ Create a connection to the PostgreSQL database """
    
    print('CONNECTION_URL ----')
    connection_url = os.getenv("CONNECTION_URL")
    print(connection_url)
    
    url_parts = urlparse(connection_url)
    
    # Create a connection pool
    connection_pool = pool.SimpleConnectionPool(
        minconn=1, maxconn=10,
        user=url_parts.username,
        password=url_parts.password,
        host=url_parts.hostname,
        port=url_parts.port,
        database=url_parts.path.lstrip('/'),
    )    
    
    try:
        with connection_pool.getconn() as conn:
            print("Connection to the database successful!")
    except (Exception, psycopg2.DatabaseError) as e:
        print_sql_err(e)
    return conn
    
def return_string_sql(*params):
    sql = f"""
       INSERT INTO public.users (
        display_name, 
        handle,
        email,
        cognito_user_id
        ) 
       VALUES({params[0]},{params[1]},{params[2]},{params[3]})
    """
    print('SQL Statement ----')
    print(sql)
    return sql

def execute_query(conn, query, *params):
    """ Execute a SQL query on the connected database """  
    
    with conn.cursor() as cursor:
        try:
            cursor.execute(query, *params)
            conn.commit()
            print("Query executed successfully!")
        except (Exception, psycopg2.DatabaseError) as e:
            print_sql_err(e)
        finally:
            cursor.close()

def print_sql_err(err):
    # get details about the exception
    err_type, traceback = sys.exc_info()

    # get the line number when exception occured
    line_num = traceback.tb_lineno

    # print the connect() error
    print ("\npsycopg ERROR:", err, "on line number:", line_num)
    print ("\npsycopg traceback:", traceback, "-- type:", err_type)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.