Skip to content

Commit

Permalink
Merge pull request #11 from rrigato/dev
Browse files Browse the repository at this point in the history
Upgrade to ASK version 1.19
  • Loading branch information
rrigato authored Mar 3, 2024
2 parents ea710dc + 90f9306 commit 7d321d5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
10 changes: 5 additions & 5 deletions layers/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Make sure to use the amazonlinux version appropriate to python version
# Make sure to use the amazonlinux version appropriate to python version
# of the operating system documented here:
# https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
FROM amazonlinux:2
Expand All @@ -7,7 +7,7 @@ ARG BUILT_LAYER_NAME

ENV PYTHON_VERSION="3.11.8"

# note that openssl-devel since it is version openssl v3.x.x
# note that openssl-devel is version v3.x.x of openssl
# is not compatiable with python 3.11.8
# The below installs openssl v1.x.x
RUN yum install -y tar \
Expand All @@ -29,18 +29,18 @@ RUN cd /opt && \
rm Python-$PYTHON_VERSION.tgz

#python install
RUN cd /opt/Python-$PYTHON_VERSION && \
RUN cd /opt/Python-$PYTHON_VERSION && \
./configure --enable-optimizations && make altinstall


RUN /opt/Python-$PYTHON_VERSION/python -m venv avenv

COPY requirements/ requirements/

# #ask-sdk-core install
#ask-sdk-core install
RUN source avenv/bin/activate && \
mkdir python && \
pip install -r requirements/requirements-dev.txt --target ./python
pip install -r requirements/requirements-dev.txt --target ./python

#bundle dependency for deployment as layer
RUN zip -r $BUILT_LAYER_NAME python
Binary file removed layers/ask_sdk_core_1_19_0.zip
Binary file not shown.
6 changes: 3 additions & 3 deletions scripts/cf_layer_orchestration.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
aws s3api put-object --bucket lambda-deployment-bundles \
--key layers/ask_sdk_core_most_recent.zip \
--key layers/ask_sdk_core_1_19_0.zip \
--body layers/ask_sdk_core_1_19_0.zip


aws cloudformation create-change-set \
--stack-name alexa-skills-kit-sdk-python-layer \
--change-set-name tvratings-new-layer-version \
--template-body file://templates/ask_lambda_layer.template
--template-body file://templates/ask_lambda_layer.template

aws cloudformation execute-change-set \
--stack-name alexa-skills-kit-sdk-python-layer \
--change-set-name tvratings-new-layer-version
--change-set-name tvratings-new-layer-version
16 changes: 10 additions & 6 deletions templates/tvratings_alexa_skill.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
AWSTemplateFormatVersion: '2010-09-09'

Description: |
Lambda function specification for a custom alexa skill and an s3 bucket for
Lambda function specification for a custom alexa skill and an s3 bucket for
built aws lambda layers

Parameters:
Expand All @@ -12,7 +12,7 @@ Parameters:

alexaSkillsKitLayerVersion:
Type: String
Default: 1
Default: 2

functionHandler:
Type: String
Expand Down Expand Up @@ -42,6 +42,10 @@ Parameters:
Type: String
Default: tvratings

pythonVersion:
Type: String
Default: python3.11

Resources:


Expand All @@ -58,7 +62,7 @@ Resources:

lambdaPythonFunction:
Type: AWS::Lambda::Function
Properties:
Properties:

Code:
S3Bucket: !Ref artifactBucket
Expand All @@ -69,13 +73,13 @@ Resources:
FunctionName: !Sub ${projectName}-alexa-skill
Handler: !Ref functionHandler

Layers:
Layers:
- !Sub 'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:layer:${alexaSkillsKitLayerName}:${alexaSkillsKitLayerVersion}'

MemorySize: !Ref lambdaMemorySize
PackageType: Zip
Role: !Sub arn:aws:iam::${AWS::AccountId}:role/${lambdaExecutionRoleName}
Runtime: python3.9
Runtime: !Ref pythonVersion
Timeout: !Ref lambdaTimeout
TracingConfig:
TracingConfig:
Mode: Active

0 comments on commit 7d321d5

Please sign in to comment.