George McKinney Adventures in Software Development

April 20, 2021

Alexa Fact Skill Content

Filed under: Alexa,Amazon,AWS — georgemck @ 5:41 pm

 

const SKILL_NAME = ‘SKILL_NAME ‘;
const GET_FACT_MESSAGE = ‘Here\’s your information: ‘;
const HELP_MESSAGE = ‘You can say tell me a fact, or, tell me about something… What can I help you with?’;
const HELP_REPROMPT = ‘What can I help you with?’;
const STOP_MESSAGE = ‘Goodbye!’;

const data = [
‘Fact Number One.’,
‘Fact Number Two.’
];

const GetNewFactHandler = {
canHandle(handlerInput) {
const request = handlerInput.requestEnvelope.request;
return request.type === ‘LaunchRequest’
|| (request.type === ‘IntentRequest’
&& request.intent.name === ‘GetNewFactIntent’);
},
handle(handlerInput) {
const factArr = data;
const factIndex = Math.floor(Math.random() * factArr.length);
const randomFact = factArr[factIndex];
const speechOutput = GET_FACT_MESSAGE + randomFact;

return handlerInput.responseBuilder
.speak(speechOutput)
.withSimpleCard(SKILL_NAME, randomFact)
.getResponse();
},
};

March 10, 2021

AWS CLI Builder

Filed under: AWS — georgemck @ 6:19 pm

Tool for constructing AWS CLI commands

https://awsclibuilder.com/home

Created by https://twitter.com/pdomala

AWS BASH Export Lambda Functions

Filed under: AWS — georgemck @ 6:18 pm

AWS CLI 2 for Exporting Lambdas

https://gist.github.com/TheNetJedi/0847ba0ec1da9879b4fa1d8f3276b004

Export all lambda functions to lambdafunctions directory as indivudual zip files. Be sure to update the region, currently set to us-east-1
This works great in AWS CloudShell

 

mkdir lambdafunctions
aws lambda --profile kickpost list-functions | \
grep FunctionName | \
cut -d '"' -f4 | \
while read -r name; do
# aws lambda --profile kickpost get-function --function-name $name | tail -n 3 | egrep -o 'https?://[^ ]+' | sed 's/"//' | xargs wget -O ./lambdafunctions/$name.zip
aws lambda --profile kickpost get-function --function-name $name | tee ./lambdafunctions/$name.json | jq -r '.Code.Location' | xargs wget -O ./lambdafunctions/$name.zip
done

# https://awscli.amazonaws.com/v2/documentation/api/latest/reference/lambda/get-function.html
# https://gist.github.com/TheNetJedi/0847ba0ec1da9879b4fa1d8f3276b004

AWS BASH Export Lex Bots

Filed under: AWS — georgemck @ 6:14 pm

AWS CLI 2 for Exporting a Bot

https://docs.aws.amazon.com/lex/latest/dg/export-to-lex.html

https://docs.aws.amazon.com/lex/latest/dg/API_GetExport.html

Export all bots to lexbots directory as indivudual zip files. Be sure to update the region, currently set to us-east-1

 

mkdir lexbots
aws lex-models get-bots | grep name | cut -d '"' -f4 | \
while read -r name; do
echo $name
url=$(aws lex-models get-export --name $name --resource-type BOT --export-type LEX --resource-version 1 --region us-east-1 --output json | grep url | cut -d '"' -f4)
wget $url -O ./lexbots/$name.zip
done

 

March 9, 2021

AWS CloudShell Gradle Install

Filed under: AWS — georgemck @ 3:12 am

Gradle versions available from:

https://gradle.org/releases/

 

sudo mkdir /opt/gradle
wget -c https://services.gradle.org/distributions/gradle-6.8.3-bin.zip
sudo unzip -d /opt/gradle gradle-6.8.3-bin.zip
export PATH=$PATH:/opt/gradle/gradle-6.8.3/bin

gradle -v

 

**NOTE:   export PATH will have to be done over with every launch of the shell. Alternatively, add it to ~/.bash_profile

PATH=$PATH:$HOME/.local/bin:$HOME/bin:/opt/gradle

 

AWS Cloudshell Java Install

Filed under: AWS — georgemck @ 3:05 am

You can switch between versions with sudo

from https://tecadmin.net/install-java-on-amazon-linux/

 

Step 1 – Install Java on Amazon Linux

The OpenJDK 8 is available under default yum repositories and OpenJDK 11 is available under Amazon Linux 2 extras repositories. You can simply install Java 11 or Java 8 on the Amazon Linux system using the following commands.

  • Run below commands to install Java 11 on Amazon Linux:
    sudo amazon-linux-extras install java-openjdk11
    
  • Run below commands to install Java 8 on Amazon Linux:
    sudo yum install java-1.8.0-openjdk
    

Step 2 – Check Active Java Version

After successfully installing Java on Amazon Linux using the above steps, Let’s verify the installed version using the following command.

java -version

openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

Step 3 – Switch Java Version

Use alternatives command-line utility to switch active Java version on your Amazon Linux system. Run below command from the command line and select the appropriate Java version to make it default.

sudo alternatives --config java

Install Java on Amazon Linux

After switching let’s check again active Java version:

java -version

openjdk version "11.0.7" 2020-04-14 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.7+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10-LTS, mixed mode, sharing)

 

 

 

January 2, 2021

AWS CloudShell Homebrew Install Process

Filed under: AWS — georgemck @ 10:35 pm

 

1. Clone.

git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew

2. Compile.

mkdir ~/.linuxbrew/bin

3. Link.

ln -s ../Homebrew/bin/brew ~/.linuxbrew/bin

4. Update environment.

eval $(~/.linuxbrew/bin/brew shellenv)

AWS CloudShell CLI Update Process

Filed under: Amazon,AWS — georgemck @ 8:36 pm

Quick Procedure to update the AWS CloudShell available for IAM user accounts following instructions per

https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html

 

curl “https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip” -o “awscliv2.zip”

unzip awscliv2.zip

sudo ./aws/install

 

 

AWS Shell Curl command
AWS Shell Unzip command
AWS Shell update command

November 20, 2020

AWS Cloud Practitioner Preparation

Filed under: Amazon,AWS,Certification — georgemck @ 12:00 am

Join AWS Certification & Training Team
at AWS re:Invent 2020

Take the challenge to follow a recommended preparation path to earn AWS Certified Cloud Practitioner. All recommended training is free, including our new interactive Twitch series, AWS Power Hour: Cloud Practitioner. The best part? You can complete the preparation path just in time to get AWS Certified before AWS re:Invent 2020 – the world’s largest, most comprehensive cloud learning event. About the AWS Cloud Practioner Certificate (PDF

 

The content covers:

  • Introduction to Cloud Computing (Cloud Basics & Storage)
  • Compute & Network
  • Databases
  • Security
  • Well-Architected Framework
  • Cloud Practioner Review

 

How to participate? 

  1. Click here to Register for AWS Global Challenge 
  2. Watch the Video Series on Twitch (see list below)
  3. Take the Exam with PSI or Pearson

Cloud Practitioner Video Series
on Twitch

Cloud Basic & Storage S2 E1 (Blaine)

Watch on Twitch (59:33) Open Twitch App (59:33)

Cloud Basic & Storage S2 E1 Q&A

Watch on Twitch (30:18) Open Twitch App (30:18)

Compute & Network S2 E2 (Blaine)

Watch on Twitch (1:00:47) Open Twitch App (1:00:47)

Compute & Network S2 E2 Q&A

Watch on Twitch (30:12) Open Twitch App (30:12)

Databases S2 E3 (Jon)

Watch on Twitch (1:01:22) Open Twitch App (1:01:22)

Databases S2 E3 Q&A

Watch on Twitch (30:44) Open Twitch App (30:44)

Security S2 E4 (Jon)

Watch on Twitch (1:05:53) Open Twitch App (1:05:53)

Security S2 E4 Q&A

Watch on Twitch (30:25) Open Twitch App (30:25)

Well-Architected Framework S2 E5 (Blaine)

Watch on Twitch (59:09) Open Twitch App (59:09)

Well-Architected Framework S2 E5 Q&A

Watch on Twitch (30:46) Open Twitch App (30:46)

Review S2 E6 (Blaine, Bailey, Dion)

Watch on Twitch (1:01:51) Open Twitch App (1:01:51)

Review S2 E6 Q&A

Watch on Twitch (32:13) Open Twitch App (32:13)

Review S2 E6 (Jon)

Watch on Twitch (1:02:06) Open Twitch App (1:02:06)

Review S2 E6 Q&A

Watch on Twitch (32:13) Open Twitch App (32:13)

 

February 1, 2020

Alexa Demo: Color Cycler using Alexa IoT Gadget

Filed under: Alexa,AWS — Tags: , , — georgemck @ 10:37 am

Project source code on Github https://github.com/georgemck/Alexa-Gadgets-Raspberry-Pi-Samples

 

« Newer Posts

Powered by WordPress