Yet another bootstrap theme.

2020-06-02
aws_glue_study_note

基本概念

  • Data Store

遇到的問題

  • 設定 connection 後,無法連結到 RDS
    • 出現的 error code 為 “At least one security group must open all ingress ports.To limit traffic, the source security group in your inbound rule can be restricted to the same security group”
    • google 後,Error的情形為Error: Inbound Rule in Security Group Required,照著說明的方式進行,test connection 就通過囉
    • 原因:security group 沒有設定好,沒有 allow security-group 本身所有的 tcp 都可以連
    • Setting Up a VPC to Connect to JDBC Data Stores

轉換 json 的資料

連動的方式

ETL job

目前 glue 的 job, 可以用 純 python or PySpark 來寫 script code, 我目前是用 PySpark 來嘗試

Reference

Read More

2020-06-02
aws_parquet_data

最近在嘗試使用 parquet & AWS athena,剛好有 google 到一些資料,先隨手記錄一下

有關 AWS Glue 相關資料

Reference

Read More

2020-06-01
another_grep_rg_command

GitHub project

Reference

Read More

2020-06-01
another_find

最近在試用 fzf 時,有看到這個類似的 find 指令。裝了之後,覺得滿好用的

  • 使用 command
    1
    $ fd PATTERN

gitHub project

  • sharkdp/fd
    • A simple, fast and user-friendly alternative to ‘find’

Reference

Read More

2020-05-23
Dao_Qinghua_Secret

最近剛好想看青華秘文,實體的書本不好買,就上網找來看囉

青華秘文

Read More

2020-05-23
dao_classic_book

最近常會查看道教的典籍,茲蒐集目前找到,覺得還滿好的網站

典籍網站

Read More

2020-05-22
watch_cloudwatch_tag

原因

  • 近來在加 AWS resource 的 tag,其中 cloudwatch 的 tag,無法由 AWS console 來看。用程式加了之後,一直找不到 cloud watch 的 tag 是否有加成功

結果

  • 找了一段時間後,才發現原來要用 aws logs help 來找,用 aws clodwatch 是找不到的
    1
    2
    3
    4
    5
    6
    7
    $ aws logs list-tags-log-group --log-group-name /aws/lambda/log-group-name
    {
    "tags": {
    "env": "dev",
    "service": "xxx-service"
    }
    }

Reference

同場加映

  • 要看 aws cloud watch log 的話,可以用 awslogs,還滿好用的
  • jorgebastida/awslogs
  • 要找需要看的 log group 時,還滿方便的
    1
    $ awslogs groups | grep -i v3 | grep -i dev
Read More

2020-05-22
add_tag_on_serverless

原因

  • 為了要細分 AWS cost 用到那部分,常見的方式為使用 Tag 來區分

做法

  • 在 serverless.conf 中的 provider block 加 stackTags , 可以標註 tag
    1
    2
    3
    4
    5
    provider:
    stackTags:
    owner: owner
    env: ${self:custom.stage}
    service: service

可以加強的部分

  • 因為 stack tag,會有些 AWS resources 沒有加到 tag, 可以用 “Serverless Repository apps” 來加強
  • lumigo-io/SAR-Propagate-CFN-Tags
    • SAR app to propagate CloudFormation’s stack tags to resources that are currently not propagated automatically - e.g. CloudWatch Logs

Reference

Read More

2020-05-22
pip_success_but_not_found

遇到的問題

  • 今天在 EC2 上,使用 virtualenv 來安裝 pandas 時,遇到 pip 有安裝成功,但是進去 ipython 時,找不到 pandas module 的情形
  • 找了一段時間後,發現 package 被安裝在 lib64 的path,而 pip 是找 lib folder,所以找不到 pandas module
    1
    2
    3
    4
    /home/ec2-user/.virtualenvs/data/lib64/python3.6/dist-packages/pandas
    /home/ec2-user/.virtualenvs/data/lib64/python3.6/dist-packages/pandas/tests/io/json/__pycache__/test_pandas.cpython-36.pyc
    /home/ec2-user/.virtualenvs/data/lib64/python3.6/dist-packages/pandas/tests/io/json/test_pandas.py
    /home/ec2-user/.virtualenvs/data/lib64/python3.6/dist-packages/pandas-1.0.3.dist-info
  • 看起來應該是某版本的 amazon linux 的問題

解法

  • 用指定路徑的方式,來執行 pip

    1
    $ pip install --upgrade --target /home/ec2-user/.virtualenvs/data/local/lib/python3.6/dist-packages pandas
  • 看 python 的 path

    1
    2
    3
    >>> import sys
    >>> sys.path
    ['', '/home/ec2-user/.virtualenvs/data/local/lib64/python3.6/site-packages', '/home/ec2-user/.virtualenvs/data/local/lib/python3.6/site-packages', '/home/ec2-user/.virtualenvs/data/lib64/python3.6', '/home/ec2-user/.virtualenvs/data/lib/python3.6', '/home/ec2-user/.virtualenvs/data/lib64/python3.6/site-packages', '/home/ec2-user/.virtualenvs/data/lib/python3.6/site-packages', '/home/ec2-user/.virtualenvs/data/lib64/python3.6/lib-dynload', '/home/ec2-user/.virtualenvs/data/local/lib/python3.6/dist-packages', '/usr/lib64/python3.6', '/usr/lib/python3.6']

Refrerence

Read More

2020-04-24
aws custom domain not work

這幾天在測試的時候,發現 dev 環境的 API Gateway Custom domain names 壞了一段時間,也就是說連到 dev 的 custom url 出現連不到網頁的 error

測試過程中,發現有如下的情形

出現的情形

  • 測試 api 程式,出現 error 連不到網址
  • 直接由 browser 連,也連不到網址
  • 用 AWS 建立出來的 api gateway 連,是可以的。透過 custom domain 無法連
  • 查 R53 的 record 時,原來的對應消失了,就手動加回去
  • 手動加回 R53 record 後,用 nslookup 查 DNS 時,出現有時查得到、有時查不出來的情形

綜合上述的情形,推測應該是由 AWS 建立出來的 ALB 怪怪的,需要重建

解法

  • 手動將 Custom domain names 設定刪除,然後重建。重建後,API mappings 也是手動加進去
  • 到 R53 的設定頁,將 DNS 設好

Endpoint type 的種類

  • Regional
    • 使用 ALB 的方式
  • Edge-optimized
    • 使用 CloudFront 的方式

reference

Read More