axcess.io
Published in

axcess.io

Execute AWS Lambda locally in Pycharm and Deploy to AWS

  1. Ensure that Python is installed in your system. If not, click here to download the Python version of your choice. (Preferably Python 3.X)
  2. Check if everything is in order using the below command from the terminal.
python --version
# Python 3.7.3.
brew --version
Homebrew 2.1.6 
Homebrew/homebrew-core (git revision ef21; last commit 2019-06-19)
brew tap aws/tap
brew install aws-sam-cli
brew upgrade aws-sam-cli
brew cask install docker
open /Applications/Docker.app
docker ps
  • Once done, restart Pycharm to get the plugin into action.
import json
def lambda_handler(event, context):
return {
"statusCode": 200,
"body": json.dumps({
"message": "hello world",
}),
}
Selecting AWS credentials
Selecting the Input Json for Lambda Function
Run Lambda Locally
Output after execution
The deployment will go live in a short while!
Give some name for the Cloudformation Stack and Select the S3 Bucket.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Govind Kumar

Technology Evangelist | Practice Lead Cloud Migration @Axcess IO | Cloud Arch. | RHC(SA/E) | AWS (DevOps/Sol. Arch) — Pro. | CCNA | AWS Networking Speciality.