Lambda to send SES email

Hi all,

I am trying to invoke a lambda to send ses email(my actual gmail) using localstack container on docker.
I would like to ask if this is actually possible. I have tried using the actual AWS Console to use a lambda that send an SES email to my email(this is working).

The steps I have taken in localstack:
Configure my docker compose.yml file which includes my actual AWS access key ID and secret access key, my region which is in ap-southeast-1.

I zipped my python file which has the lambda function to send an ses email and cp into my localstack container.

I used aws configure and make sure the user is correct etc.
I used the create function lambda as follows:

awslocal lambda create-function
–function-name send
–runtime python3.10
–zip-file fileb:///test1.zip
–handler test1.lambda_handler
–role arn:aws:iam::adadawsdasd:role/xxx (indicated my actual role based on my AWS official role that has permission to execute lambda and send email)

I then tried to invoke the function
awslocal lambda invoke --function-name send output.txt

after invoking the function, I have an error which states invalid security token ID, my guess is that there is something wrong with the way I configure my AWS Credentials in localstack.

I have been stuck on this issue for several days(currently doing for one of my school project).
All help is appreciated! thank you.

Hi @boogywumpy,

Please refer to the LocalStack documentation Getting Started for instructions on using and setting up LocalStack. It appears that you may be mixing AWS configuration with LocalStack setup.

For specific guidance on using Simple Email Service (SES) and Lambda with LocalStack, please consult the following documentation:

To begin with SES commands, you can utilize the LocalStack wrapper for the AWS Command Line Interface (CLI) as described in the AWS Command Line Interface documentation.

I hope this information helps you get started with your issue.