This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Transform: AWS::Serverless-2016-10-31 | |
Resources: | |
SourceBucket: | |
Type: AWS::S3::Bucket | |
DestinationBucket: | |
Type: AWS::S3::Bucket | |
Function: | |
Type: AWS::Serverless::Function | |
Properties: | |
CodeUri: src/Function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Transform: AWS::Serverless-2016-10-31 | |
Resources: | |
Function: | |
Type: AWS::Serverless::Function # This resource is a Lambda function | |
Properties: | |
CodeUri: src/Function # Location in your file structure where the function code is saved | |
Handler: index.handler # Your Lambda function handler, or the method in your function code that's called every time your function is invoked | |
Runtime: python3.11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given a list id, retrieve an array with word ids and simplified characters for that list | |
# This function is part of a state machine that generates pronunciation audio files for a given list | |
import list_word_service | |
def lambda_handler(event, context): | |
list_id = event['list_id'] | |
last_word_token = event['last_word_token'] | |
# Call to list_word_service, a shared service in the application | |
# for querying DynamoDB for words by list ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GenerateAudioStateMachine: | |
Type: AWS::Serverless::StateMachine | |
Properties: | |
Name: !Sub GenerateAudioStateMachine-${Stage} | |
DefinitionUri: src/generate_audio_state_machine.asl.json | |
DefinitionSubstitutions: | |
TableName: !Ref DynamoDBTable | |
GetWordsForListIdFunction: !Ref GetWordsForListId | |
PronunciationAudioBucket: !Ref PronunciationAudioBucket | |
Policies: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Comment": "Generates and save audio files for a given list ID.", | |
"StartAt": "Get word list", | |
"States": { | |
"Get word list": { | |
"Type": "Task", | |
"Resource": "arn:aws:states:::lambda:invoke", | |
"OutputPath": "$.Payload", | |
"Parameters": { | |
"Payload": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: 'AWS::Serverless-2016-10-31' | |
Description: An example deployment for migrating data between DynamoDB tables | |
Resources: | |
ExistingTable: | |
Type: AWS::DynamoDB::Table | |
DeletionPolicy: Retain | |
Properties: | |
TableName: ExportDataTable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ModelName": "full-table-design", | |
"ModelMetadata": { | |
"Author": "", | |
"DateCreated": "Jun 04, 2021, 05:33 PM", | |
"DateLastModified": "Jun 16, 2021, 11:01 PM", | |
"Description": "", | |
"AWSService": "Amazon DynamoDB", | |
"Version": "3.0" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import boto3 | |
# Specify your existing (export) and new (import) table names and the region your tables are in | |
export_table_name = "ExportDataTable" | |
import_table_name = "ImportDataTable" | |
dynamodb = boto3.resource('dynamodb', region_name='us-east-1') | |
table = dynamodb.Table(import_table_name) | |
def import_table_data(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import boto3 | |
# Specify your table name and the region your table is in | |
export_table_name = "ExportDataTable" | |
dynamodb = boto3.resource('dynamodb', region_name='us-east-1') | |
table = dynamodb.Table(export_table_name) | |
def export_table_data(): | |
print(f"Exporting data from {export_table_name}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import boto3 | |
import datetime | |
from typing import List, Dict | |
from dataclasses import dataclass | |
from boto3.dynamodb.conditions import Key | |
@dataclass | |
class Subscription: | |
list_name: str |
NewerOlder