It is no coincidence that AWS is best cloud service for developer with 60% or 70% in market. AWS has varioty of services which coders admit that can not use and understand all. However, lambda function is the most popular technique every developers all know. Now, I'm going to share my experiance in contribute lambda function by python.

First of all, IAM is concept we need to know because It apply for all services. IAM (Identity and Access Management) is a service helps us securely control access to AWS resources. When we create AWS account, AWS provide a account root user but we only use it for special task. Normally, we use IAM to build and develop service.

Now, we create an IAM user then get access key and secret key. We isntall AWS CLI following document

aws configure # AWS Access Key ID [None]: ExampleAccessKey # AWS Secret Access Key [None]: ExampleSecretKey # Default region name [None]: us-west-2

We can use --profile to add more IAM user

Coders can develope directly in cloud via aws portal but it's inconvenience for debug and need to deploy manually when code changes.

Image


Another way I prefer is runing locally by SAM (Serverless Application Model). SAM is open source support to work on AWS such as run locally, deployment, interact with CloudFormation and so on. Basiclly, SAM description resources exactly in YAML template. So that, we can reuse and easier manage resources.


Image

Let's install SAM CLI.

brew tap aws/tap brew install aws-sam-cli sam local start-api -p 3000 --template=aws_cfts/sqa-lambdas.yaml --profile developer


Image

We will explain SAM more in another topic. Now we deploy resources to AWS by terminal. Remember, AWS SAM base on CloudFormation so that we can interact with stack by argument --stack-name

sam deploy --template-file aws_cfts/sqa-lambdas.yaml --stack-name sqa-lambdas --resolve-s3 --profile developer --confirm-changeset


Developers can see log in function by Cloudwatch.

Image

Steve Nguyen

© Steve CV. All rights reserved.
Design - TemplateFlip