Skip to content

Instantly share code, notes, and snippets.

View jbesw's full-sized avatar

James Beswick jbesw

View GitHub Profile
import json
import boto3
import os
from langchain.llms.bedrock import Bedrock
from langchain import PromptTemplate
from typing import Optional, List, Mapping, Any, Dict
from langchain.retrievers import AmazonKendraRetriever
from langchain.chains import RetrievalQA
S3_BUCKET_NAME = os.environ["S3_BUCKET_NAME"]
{
"title": "Resources for re:Invent SVS402",
"description": "Learsn how to build a complete serverless web application for a popular theme park called Innovator Island. The theme park is rolling out a mobile app that provides thousands of visitors with wait times, photo opportunities, notification alerts, and language translation for visitors who need it. In this series, you'll get hands-on experience building a scalable serverless application with a single-page application (SPA) front-end that delivers a feature-rich user experience. Expect to leave this series with a solid understanding of serverless concepts like event-driven computing and real time messaging, as well practical hands-on experience deploying a serverless mobile front-end and using IoT to send messages to thousands of users in real time. Your experience with Innovator Island will prepare you to bring serverless best practices to your next serverless application.",
"introBox": {
"headline": "Decoupling serverless workloads with Ama
@jbesw
jbesw / gist:f9401b4c52a7446ef1bb71ceea8cc3e8
Created August 4, 2020 11:39
AWS CloudFormation template to create public/private subnets in a VPC with a NAT Gateway.
# This creates a VPC with two public subnets and two private subnets in two Availability Zones,
# together with a NAT Gateway and associated routing. Change the Availability Zone locations as needed.
# Important: this configures various AWS services and there are costs associated with these services after the Free Tier usage.
# Please see the AWS Pricing pages for details. You are responsible for any AWS costs incurred.
# No warranty is implied in this example.
# Usage from command line:
# aws cloudformation --region <<YOUR-REGION>> create-stack --stack-name vpc- --template-body file://vpc-setup.yaml
@jbesw
jbesw / gist:7058cae2a637c22970f0e0e362f45aaf
Created June 11, 2020 14:55
Fix UUID broken code in Innovator Island
cd ~/environment/theme-park-backend/
git pull
cd ~/environment/theme-park-backend/1-app-deploy/sam-app/
sam package --output-template-file packaged.yaml --s3-bucket $s3_deploy_bucket
sam deploy --template-file packaged.yaml --stack-name theme-park-backend --capabilities CAPABILITY_IAM
@jbesw
jbesw / gist:08469b18bc45eed1f4b2c0783d132f5d
Last active July 22, 2022 08:19
EventBridge Rule for Logging to CloudWatch Logs
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: EventBridge Rule Test
Resources:
CFNLogGroup:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: 3
LogGroupName: '/aws/events/eventbridgeLog'
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
@jbesw
jbesw / index.html
Created June 24, 2019 17:28
Serverless Form Example
<!--
MIT No Attribution
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
@jbesw
jbesw / index.js
Last active March 24, 2023 07:07
Language translation with S3 and AWS Translate
/*
MIT No Attribution
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so.
@jbesw
jbesw / .gitlab-ci.yml
Last active November 30, 2021 00:20 — forked from m8r1x/.gitlab-ci.yml
Basic skeleton of Gitlab CI integration with AWS Lambda for auto deployments.
image: docker:latest
variables:
- enableCostAnalysis: "true"
before_script:
- apt-get update -y # Updating the Ubuntu Docker instance.
- python -V # Print out python version for debugging.
- apt install -y zip jq
- pip install awscli --upgrade --user