Skip to content

sfn-glue-sam: Replace deprecated Python shell 3.6 with 3.9#3130

Open
kakakakakku wants to merge 3 commits into
aws-samples:mainfrom
kakakakakku:sfn-glue-sam
Open

sfn-glue-sam: Replace deprecated Python shell 3.6 with 3.9#3130
kakakakakku wants to merge 3 commits into
aws-samples:mainfrom
kakakakakku:sfn-glue-sam

Conversation

@kakakakakku

@kakakakakku kakakakakku commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Issue #, if available:
N/A

Description of changes:
Hi😀 Thanks for the useful patterns!

This pattern was last updated about 5 years ago and currently doesn't work because Python shell 3.6 reached end of support on March 1, 2026. I made the following updates to bring it back to a working state.

Check

sam deploy completed successfully and works good.

$ aws s3 mb s3://kakakakakku-sfn-glue-sam-artifacts
make_bucket: kakakakakku-sfn-glue-sam-artifacts

$ aws s3 mb s3://kakakakakku-sfn-glue-sam-data
make_bucket: kakakakakku-sfn-glue-sam-data

$ aws s3 cp code/glue s3://kakakakakku-sfn-glue-sam-artifacts/glue --recursive

$ sam build --template code/cloudformation/stack.yaml
$ sam deploy --guided

CloudFormation outputs from deployed stack
-----------------------------------------------------------------------------------------------------------------------------
Outputs                                                                                                                     
-----------------------------------------------------------------------------------------------------------------------------
Key                 GlueJobName                                                                                             
Description         -                                                                                                       
Value               Feature Engineering                                                                                     

Key                 ETLStepFunctionsARN                                                                                     
Description         -                                                                                                       
Value               arn:aws:states:ap-northeast-1:000000000000:stateMachine:ETLStepFunctions-9pMndnlymAiz
-----------------------------------------------------------------------------------------------------------------------------


Successfully created/updated stack - sfn-glue-sam in ap-northeast-1
image image

Thank you😀


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

MaxConcurrentRuns: 1
DefaultArguments:
"--extra-py-files": !Sub "s3://${ArtifactsBucket}/glue/libs/awswrangler-2.12.0-py3-none-any.whl"
"--library-set": "analytics"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: The bundled awswrangler-2.12.0 whl is from 2021 and there's no real need to bundle it individually anymore. We can use --library-set: analytics option 👍
See https://docs.aws.amazon.com/glue/latest/dg/add-job-python.html

"--extra-py-files": !Sub "s3://${ArtifactsBucket}/glue/libs/awswrangler-2.12.0-py3-none-any.whl"
"--library-set": "analytics"
"--config_path": !Sub "${ETLParametersPath}"
GlueVersion: "1.0"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: GlueVersion is ignored for Python shell jobs.

You don't need to specify the version of AWS Glue since the parameter --glue-version doesn't apply for AWS Glue shell jobs. Any version specified will be ignored.
https://docs.aws.amazon.com/glue/latest/dg/add-job-python.html

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread sfn-glue-sam/Readme.md
The SAM template deploys:
* A Step Functions State Machine
* An EventBridge rule that triggers the Step Functions every 2 days
* An EventBridge rule that triggers the Step Functions every 2 days (disabled by default)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: The schedule is Enabled: False in stack.yaml, so it doesn't trigger automatically after deploy.

Comment thread sfn-glue-sam/Readme.md
1. Copy glue job script and libs:
1. Manually create two Amazon S3 buckets:
- `ARTIFACTS_BUCKET` — stores the AWS Glue job script.
- `DATA_BUCKET` — stores the source data for the AWS Glue job.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: These two S3 buckets are not created by the stack. They need to exist before deployment. The original README didn't mention this step at all, so first-time users would likely hit a deploy error without knowing why. Added explicit creation commands with a short note on each bucket's role😀

Command:
Name: pythonshell
PythonVersion: "3"
PythonVersion: "3.9"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants