Skip to content

Instantly share code, notes, and snippets.

@apacheservices68
Last active September 29, 2023 03:32
Show Gist options
  • Save apacheservices68/06096c2b261581ed0d8af61a473c697a to your computer and use it in GitHub Desktop.
Save apacheservices68/06096c2b261581ed0d8af61a473c697a to your computer and use it in GitHub Desktop.

Revisions

  1. apacheservices68 renamed this gist Sep 29, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. apacheservices68 created this gist Sep 21, 2023.
    22 changes: 22 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    - The first step is to create Role for aws lambda with RDS permission: (ớ bước đầu tiên , tạo 1 vai trò cho func lambda với quyền truy cập vào RDS service)
    1. Go to IAM console , click /Role and then create role for lambda . (Truy cập vào IAM console , click tạo role, chọn mục lambda)
    2. For permission tab , search RDSFullAccess and select it. (Ở tab quyền , search RDSFullPermission và chọn nó)
    3. As end tab , we give role name and click save role. (Ở tab cuối, ta điền tên vai trò và lưu)

    - The second step is create two new security group in your existing VPC: (Ở bước thứ hai , tạo 2 security group trong default VPC đã tồn tại)
    1. Give the name "LambdaSecurityGroup" and save.
    2. Give the name "DatabaseSecurityGroup" and save.
    3. Now , we go to the inbound rules of "DatabaseSecurityGroup" and click edit rule and add new rule with Postgres [port 5432]
    and set source id is "DatabaseSecurityGroup" , click save rule.

    - The next step is create RDS instance.
    1. Go to RDS console and click create database , select all your configuration.
    2. For security group panel , we select "DatabaseSecurityGroup" and click create database.

    - The next step is create or deploy lambda function.
    1. I deploy serverless function with go1.x runtime (just for me).
    2. Next , On the Network Section or VPC section , click edit / add new VPC.
    3. Chose default VPC, default subnets, and "LambdaSecurityGroup" , continue wait for VPC applying.

    - Now ,create sample test environment and click test on the lambda console . It should return some output with Database writes
    , that's it.