Your First AWS Lambda Function In VS Code – 10 Minute Tutorial – For Beginners

    15
    37



    ❗️ In this video, we will develop and deploy a Lambda Function LOCALLY in VS Code using the AWS Toolkit Extension.

    🧠 Developing locally speeds up the development cycle drastically.

    If you’ve tried to make a Lambda Function for more than 5 minutes you’ve run into the problem of how to actually develop and debug it. You probably tried to use the IDE in the AWS console, but quickly realized there are some drawbacks.

    The good news is that thanks to the AWS toolkit extension it’s actually really easy to develop Lambda functions in VS code then deploy them.

    TIMESTAMPS:
    0:00​ Intro
    0:10 How I Use Lambda
    0:25 The Problem
    1:21 Download AWS Toolkit
    2:43 Create Lambda Function
    4:32 Test
    5:20 Deploy To AWS
    7:09 Test In AWS
    9:05 Conclusion

    WHO AM I: I’m Dylan, a Cloud Engineer living in Oregon. I use my background in tech to make videos about technology that enables and grows businesses.

    🌍 My website / blog –
    https://dylanalbertazzi.com/

    source

    Previous articleAWS Tutorial – Launch a RDS MySQL instance and connect to it using Linux EC2
    Next articleApa itu RPA (Robotic Process Automation) ? Kemampuan dan Kelebihan menggunakan RPA

    37 COMMENTS

    1. Thanks for this video but unfortunately I am receiving the below error, I'd tried multiple things over google like aws configure etc but couldn't find the solution, can anyone help me regarding this?
      "Error: Failed to create managed resources: An error occurred (InvalidClientTokenId) when calling the CreateChangeSet operation: The security token included in the request is invalid "

    2. Okay so if anyone else had trouble with the sam deploy –guided, there's a big rabbit hole there . First off, you need to download the SAM CLI, which allows you to use SAM. Straightforward download. Then afterwards, you'll need to have IAM roles configured for the SAM deploy to work. You'll need to have the AWS CLI installed. Also another straightforward download. Then you need to create an IAM role on (Good explanations online). And then finally, you can use the AWS CLI to configure the IAM role you created. Which will then grant the permissions necessary for sam to deploy the application.

    3. Dylan Albertazzi, thank you the video is a good tutorial and very well explained, but I have reached the point where it says SAM configuration environment [default]: and when I press enter I get the following error and I can not find a solution.

      Could you give me some hint or clue please?

      Traceback (most recent call last):

      File "runpy.py", line 194, in _run_module_as_main

      File "runpy.py", line 87, in _run_code

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagessamcli__main__.py", line 12, in <module>

      cli(prog_name="sam")

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesclickcore.py", line 829, in _call_

      return self.main(*args, **kwargs)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesclickcore.py", line 782, in main

      rv = self.invoke(ctx)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesclickcore.py", line 1259, in invoke

      return _process_result(sub_ctx.command.invoke(sub_ctx))

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesclickcore.py", line 1066, in invoke

      return ctx.invoke(self.callback, **ctx.params)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesclickcore.py", line 610, in invoke

      return callback(*args, **kwargs)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagessamclilibcli_validationimage_repository_validation.py", line 76, in wrapped

      return func(*args, **kwargs)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesclickdecorators.py", line 73, in new_func

      return ctx.invoke(f, obj, *args, **kwargs)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesclickcore.py", line 610, in invoke

      return callback(*args, **kwargs)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagessamclilibtelemetrymetric.py", line 153, in wrapped

      raise exception # pylint: disable=raising-bad-type

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagessamclilibtelemetrymetric.py", line 122, in wrapped

      return_value = func(*args, **kwargs)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagessamclilibutilsversion_checker.py", line 42, in wrapped

      actual_result = func(*args, **kwargs)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagessamcliclimain.py", line 90, in wrapper

      return func(*args, **kwargs)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagessamclicommandsdeploycommand.py", line 206, in cli

      do_cli(

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagessamclicommandsdeploycommand.py", line 291, in do_cli

      guided_context.run()

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagessamclicommandsdeployguided_context.py", line 351, in run

      self.guided_prompts(_parameter_override_keys)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagessamclicommandsdeployguided_context.py", line 176, in guided_prompts

      s3_bucket = manage_stack(profile=self.profile, region=region)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagessamclilibbootstrapbootstrap.py", line 22, in manage_stack

      outputs: StackOutput = manage_cloudformation_stack(

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagessamclilibutilsmanaged_cloudformation_stack.py", line 86, in manage_stack

      return _create_or_get_stack(cloudformation_client, stack_name, template_body, parameter_overrides)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagessamclilibutilsmanaged_cloudformation_stack.py", line 97, in _create_or_get_stack

      ds_resp = cloudformation_client.describe_stacks(StackName=stack_name)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesbotocoreclient.py", line 386, in _api_call

      return self._make_api_call(operation_name, kwargs)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesbotocoreclient.py", line 691, in _make_api_call

      http, parsed_response = self._make_request(

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesbotocoreclient.py", line 711, in _make_request

      return self._endpoint.make_request(operation_model, request_dict)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesbotocoreendpoint.py", line 102, in make_request

      return self._send_request(request_dict, operation_model)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesbotocoreendpoint.py", line 132, in _send_request

      request = self.create_request(request_dict, operation_model)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesbotocoreendpoint.py", line 115, in create_request

      self._event_emitter.emit(event_name, request=request,

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesbotocorehooks.py", line 356, in emit

      return self._emitter.emit(aliased_event_name, **kwargs)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesbotocorehooks.py", line 228, in emit

      return self._emit(event_name, kwargs)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesbotocorehooks.py", line 211, in _emit

      response = handler(**kwargs)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesbotocoresigners.py", line 90, in handler

      return self.sign(operation_name, request)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesbotocoresigners.py", line 162, in sign

      auth.add_auth(request)

      File "C:Program FilesAmazonAWSSAMCLIruntimelibsite-packagesbotocoreauth.py", line 373, in add_auth

      raise NoCredentialsError()

      botocore.exceptions.NoCredentialsError: Unable to locate credentials