Sample application managed with AWS CDK v2 (TypeScript).

honyakutter-ts

This is an application that translates text entered in Japanese into English and tweets it, defined using AWS CDK v2 (TypeScript) and using AWS Step Functions to connect the translation and tweeting processes.

Preparation

  1. Check your AWS CDK version.

    cdk --version

    If you have not installed it, please use the following command to install it.

    npm install -g aws-cdk

    This application is intended for use with AWS CDK v2.0.0 or higher.

  2. Check your Go version

    go version

    This application is intended for use with Go 1.17.

  3. Getting Twitter API's some tokens.

    ⚠️ You will need the Twitter API key and secret, as well as the access token and access token secret. Please create an app on the Twitter Developer page and obtain each token.

  4. Create .env file.

    cp .env.sample .env

    And, replace values of each environment variables.

  5. Load environment variables.

    source .env

Build

  1. Build Translate Lambda Function

    make build-translate
  2. Build Tweet Lambda Function

    make build-tweet

Deploying

  1. bootstrap (If you haven't done so already)

    cdk bootstrap
  2. Build Lambda functions

    make build
  3. Load environment values

    make load-env
  4. Generate CFn template

    cdk synth
  5. deploy

    cdk deploy

Testing


Manual execution

Execute Lambda functions and Step Functions state machine manually by using AWS CLI.. (The latest versions at the time of this writing are v2.4.4 and 1.22.18.)

Translate Lambda Function

aws lambda invoke \
--function-name honyakutter-ts-translate-function \
--invocation-type RequestResponse \
--region ap-northeast-1 \
--payload fileb://testdata/translate_lambda_payload.json \
out && cat out

Tweet Lambda Function

aws lambda invoke \
--function-name honyakutter-ts-tweet-function \
--invocation-type Event \
--region ap-northeast-1 \
--payload fileb://testdata/tweet_lambda_payload.json \
out

Start state machine

  1. Get state machine ARN

    STATEMACHINE_ARN=$(
        aws stepfunctions list-state-machines \
        --query "stateMachines[?name=='honyakutter-ts-translate-tweet-state-maschine'].stateMachineArn" \
        --output text
    ) && echo "${STATEMACHINE_ARN}"
  2. execute

    aws stepfunctions start-execution \
    --state-machine-arn "${STATEMACHINE_ARN}" \
    --input file://testdata/statemachine_input.json

Licence

MIT

Author

michimani210

Similar Resources

A package for access aws service using AWS SDK for Golang

goaws 🚀 A package for access aws service using AWS SDK for Golang Advantage with goaws package Example for get user list IAM with AWS SDK for Golang

Nov 25, 2021

Simple CRUD API written in Go, built using AWS SAM tool and using the AWS' infrastructure.

Simple CRUD API written in Go, built using AWS SAM tool and using the AWS' infrastructure.

tutor-pet API Simple CRUD API written in Go, built using AWS SAM tool and using the AWS' infrastructure. Macro architecture: Code architecture: Pre-Re

Aug 17, 2022

Aws-parameter-bulk - Export AWS SSM Parameter Store values in bulk to .env files

aws-parameter-bulk Utility to read parameters from AWS Systems Manager (SSM) Par

Oct 18, 2022

Aws-console-plugin - The current HashiCorp Vault AWS Secret Engine currently supports the creation of short lived API keys using the IAM User

aws-console-plugin Background The current HashiCorp Vault AWS Secret Engine curr

Feb 7, 2022

Aws-cognito-demo-go - Source code for AWS Cognito in Go

AWS Cognito Demo in Go Source code for YouTube series, AWS Cognito in Go - https

Dec 10, 2022

Una prueba técnica: Servicio Golang REST API local, sobre Docker, gRPC, AWS Serverless y sobre Kubernetes en AWS EC2

Una prueba técnica: Servicio Golang REST API local, sobre Docker, gRPC, AWS Serverless y sobre Kubernetes en AWS EC2

May 7, 2022

Sample serverless application written in Golang

Sample serverless application written in Golang

Serverless Go Demo This is a simple serverless application built in Golang. It consists of an API Gateway backed by four Lambda functions and a Dynamo

Dec 15, 2022

To-Do list in GoLang with Redis as a backend -- Sample project for proof of concepts

🗒 GoLang To-Do List Sample App w/ Redis 📝 Description A simple to-do list app written in GoLang with Redis as a backend showing a few GoLang feature

Dec 14, 2021

Go-serverless-eth-event-listener - Go serverless, ethereum contract event listener with a sample contract

go-serverless-eth-event-listener This repository is for showing how to listen sm

May 19, 2022
Api-waf-example-cdk - Demo using sam to drive a CDK serverless api

CDK SAM Demo Demo using sam to drive a CDK serverless api Stack Setup go build -

Feb 5, 2022
Sample CDK projects developed by AWS Professional Services (ProServe)

AWS CDK Examples - ProServe This repository contains a set of CDK example projects which have been developed by AWS Professional Services (ProServe).

Dec 27, 2022
Http apis with AWS CDK for Go

Http apis with AWS CDK for Go Blog: https://harshq.medium.com/building-apps-with-aws-sdk-for-golang-api-gateway-and-lambda-b254858b1d71 Useful command

Jan 4, 2022
Terraform CDK aws Provider

Terraform CDK aws Provider

Jul 29, 2022
Create an ESK cluster using CDK and Golang.

Welcome to your CDK Go project! This is a blank project for Go development with CDK. NOTICE: Go support is still in Developer Preview. This implies th

Feb 14, 2022
Simple no frills AWS S3 Golang Library using REST with V4 Signing (without AWS Go SDK)

simples3 : Simple no frills AWS S3 Library using REST with V4 Signing Overview SimpleS3 is a golang library for uploading and deleting objects on S3 b

Nov 4, 2022
Integrate AWS EKS Anywhere cluster with AWS Services
 Integrate AWS EKS Anywhere cluster with AWS Services

This article provides step-by-step instruction on integrating AWS EKS Anywhere with AWS Services so the applications running on customer data center can securely connect with these services.

Mar 6, 2022
Apis para la administracion de notifiaciones, utilizando servicios como AWS SNS y AWS SQS

notificacion_api Servicio para envío de notificaciónes por difusión en AWS SNS Especificaciones Técnicas Tecnologías Implementadas y Versiones Golang

Jan 7, 2022
AWS credential_process utility to assume AWS IAM Roles with Yubikey Touch and Authenticator App TOPT MFA to provide temporary session credentials; With encrypted caching and support for automatic credential refresh.
AWS credential_process utility to assume AWS IAM Roles with Yubikey Touch and Authenticator App TOPT MFA to provide temporary session credentials; With encrypted caching and support for automatic credential refresh.

AWS credential_process utility to assume AWS IAM Roles with Yubikey Touch and Authenticator App TOPT MFA to provide temporary session credentials; With encrypted caching and support for automatic credential refresh.

Dec 20, 2022