Hi im trying to connect to mySQL server hosted on aws using an AWS lambda function.I'm very new to this so it would be of great help if someone could provide me any sample code.
Objective is to devlop an alexa skill which retrieves certain data from the db and provides this as output
Please read lambda documentation on creating lambda deployment package which will answer your question. Ensure the packaged environment is same as Lambda Environment (Amazon Linux)
http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
Related
No clear path to do development in a serverless environment.
I have an API Gateway backed by some Lambda functions declared in Terraform. I deploy to the cloud and everything is fine, but how do I go about setting a proper workflow for development? It seems like a struggle to push every small code change to the cloud while developing in order to run your code. Terraform has started getting some support by the SAM framework to run your Lambda functions locally (https://aws.amazon.com/blogs/compute/better-together-aws-sam-cli-and-hashicorp-terraform/), but still no way to simulate a local server and test out your endpoints in Postman for example.
First of all I use serverless plugin instead of terraform, my answer is based on what you provided and what I found around.
From what I understood so far with priovided documentation you are able to run sam CLI with terraform (cf: Chapter Local testing)
You might follow this documentation to invoke local functions.
I recommend to use JSON files to create use cases instead of stdin injection.
First step is to create your payload in json file and to invoke your lambda with the json payload like
sam local invoke "YOUR_LAMBDA_NAME" -e ./path/to/yourjsonfile.json
If I am correct, it is possible to deploy my Lambda function using a Docker container that I have built and pushed to AWS ECR.
https://aws.amazon.com/blogs/aws/new-for-aws-lambda-container-image-support/
But the article mentioned above, does not explain how to integrate it with the docker image that I am already using. For e.g. I have a dockerized API built using a flask application. How do I convert it to Lambda function?
I'm trying to deploy the zipped lambda functions to lambda application using codedeploy but unable to deploy. But i'm able to switch traffic from alreday existing lambda current version to newer versions..using appspec file declaration. Not sure if codedeploy support deployment of lambdas. Can someone help me with this.
CodeDeploy supports deployment to Lambda natively.
https://docs.aws.amazon.com/codedeploy/latest/userguide/applications-create-lambda.html
https://docs.aws.amazon.com/codedeploy/latest/userguide/tutorial-lambda-sam.html
I am interested to run this acme.sh a LetsEncrypt bash client within AWS Lambda to generate a ECDSA wildcard SSL cert.
I read that AWS lambda now supports bash via Layers.
The documentation within AWS Lambda developer guide doesn't really paint a clear picture for me to do this.
So I was wondering if somebody can help make the developer guide clearer for me in this particular context.
This script is a bit heavy for lambda, id suggest trying to use AWS Fargate instead, which lets you spin up dynamic containers, there's a Dockerfile already in the repo, so start from there.
You can run certbot (that is written with python) on AWS Lambda using python runtime to generate wildcard SSL certs using DNS challenge.
You can also check the complete certbot-lambda script that generates certs and exports them to [AWS](AWS Secrets Manager).
I am developing aws lambda function and I have an option of using one of these two function, but I don't find any good place where I can see the difference between these two. Which one should be used and in which case?
AWS serverless application model i.e. AWS SAM is used to define a serverless application. You need to deploy this application on AWS lambda via s3.
SAM comes in action while testing the AWS Lambda Function locally because it's not easy to deploy and test on AWS Lambda every time you make a code change.
You can configure SAM on your IDE like eclipse, test and finalise the code then deploy it on Lambda.
For more info about sam https://github.com/awslabs/serverless-application-model/blob/master/HOWTO.md