How to confirm that my AWS Lambda function is updated successfully? - amazon-web-services

The last words I can read from intellij AWS console after hitting update Lambda function is, "Waiting for function to stabilize". There is never a confirmation message that my lambda function is updated in the cloud. Nor can I find my current function id in AWS console (in this case it is cc3988579bd7cb089e84d6bb09066c24).
Successfully packaged artifacts and wrote output template to file /Users/xxx/...
Execute the following command to deploy the packaged template
sam deploy --template-file /Users/xxx/...
Waiting for function to stabilize

I couldn't find any keyword relates to "update" from within the function. Then I found it in the function list. (Inspired by Oleksii Donoha, thank you)

Related

How to find lambda function's invocation event?

I have a lambda function that is written by the dev team.
I want to test its log format using cloudwatch logs insights, my problem is that how I test lambda with proper error code and description which are needed to be verified in log format.
All I have is a previous log entry for the month of May, is there a way to find the event used in order to invoke lambda function?

AWS CodeBuild/CodePipeline user input parameters

I'm new to AWS and transitioning from Azure. I would like to create a pipeline in CodePipeline which asks the user for input (for example: the user needs to input a value for the variable "hello"), and uses that input to run a CodeBuild project. In Azure DevOps this was quite easy to define in the pipeline YML specification, but I can't seem to find a way to easily do this in AWS, or am I missing something?
AWS CodePipeline not supporting this feature currently. What you can do is, pass this parameter in your commit message (if pipeline trigger on commits to branches) or in your Git tag (if pipeline trigger on git tag push).
example:
commit message: my commit message [my_var]
git tag: my_var-1.0.0
Then in your buildspec.yml file collect the commit message or tag and check whether it contains your required parameters. If so execute the next commands otherwise exit the script.

Conditionally execute stage in AWS Codepipeline

I would like to conditionally execute certain stage in AWS Codepipeline depending on that if I put certain file on repo location. So, if I put "some_file.txt" on certain location in repo, I want for Codepipeline to check existence of this file and if it's there continue further to deploy code to production, otherwise stop on that stage.
With this I would like to avoid manual approval action and control release process with committing a file. Is this possible and what would be best practice?
I think you could create a lambda action for that:
Invoke an AWS Lambda function in a pipeline in CodePipeline
The lambda function can access the input artifact, and check if your file of interest is there or not.
Depending on the outcome of the check, the function with either put_job_success_result or put_job_failure_resul to continue or stop the pipeline.
you can use the spec file to check if there's the needed file present. If not, then you can execute a "stop-pipeline-execution" https://docs.aws.amazon.com/cli/latest/reference/codepipeline/stop-pipeline-execution.html
command. The required args can be fetched from the env vars and one more thing to note is to give that stage of yours adequate permission(s) to be able to execute the command.

Updating AWS Lambda with New Zip File?

So I've created an AWS Lambda using a the AWS CLI. I did this by running the command:
aws lambda create-function
with the argument
--zip-file fileb://file-path/zipFile.zip
So then I want to make a change to the source code, so I made a new zip file but the lambda still executes with the old zip file's source code. Thus I tried to run the same command again but got the following error:
Function already exist: FunctionName
So either I just have to abandon that function and create a new one with the new zip file or there's some way for me to update the existing function to use the new zip file's code.
Is there a way for me to do this update, and if so, how?
create-function, as the name implies, creates functions. It does not update them with new code. For that you need update-function-code. This also takes a --zip-file argument.
While this updates the code, you may also need to publish a new version of the function for the changes to take effect. This can be done by adding the --publish argument to update-function-code, or as a separate step with the publish-version command.

Amazon S3 object event creation

my AWS S3 bucket is associated with a Lambda function. Lambda is triggered by file insertion with certain file name. There is a XML file inside the same bucket from which lambda function reads the setting. The problem I am facing is that, when ever the settings file is not present/settings in the XML is wrong, the lambda launch will fail. But when the settings are made correct, lambda will get triggered for old files as well, where lambda got failed previously. I don't want trigger the Lambda again, once its failed for same file. Can some one direct me how to do that?
Take a look at the docs here:
http://aws.amazon.com/lambda/faqs/
Lambda will attempt to execute your event at least 3 times before it gives up.
If you can handle the errors in your function (related to reading the config file), so that the Lambda Function exists with out error, then Lambda will not (normally) run your function again.