Apex
Apex
Apex는 AWS lambda function 빌드, 배포, 관리를 편리하도록 도와주는 툴이다
설치
- mac, linux, OpenBSD
$ curl https://raw.githubusercontent.com/apex/apex/master/install.sh | sh
- window : 바이너리 설치
인증 설정
$ ~/.aws/credentials
[example]
aws_access_key_id = xxxxxxxx
aws_secret_access_key = xxxxxxxxxxxxxxxxxxxxxxxx
$ ~/.aws/config
[profile example]
region = ap-northeast-2
프로젝트 생성
$ mkdir example
$ cd example
$ apex init # project name, description 등 설정
$ apex deploy
폴더 구조
├── functions
│ └── hello
│ └── index.js
└── project.json
테스트
$ vim event.json
{"hello": "world"}
$ apex invoke hello < event.json
$ apex invoke hello # without event
project.json
- name: 프로젝트명
- description: 프로젝트 설명
- runtime: lambda의 런타임 설정
- java (Java 8)
- python (Python 2.7)
- nodejs (Node.js 0.10)
- nodejs4.3 (Node.js 4.3)
- nodejs6.10 (Node.js 6.10)
- golang (any version)
- clojure (any version)
- rust-musl[^rust-runtime][^rust-linux-only] (any version)
- rust-gnu[^rust-runtime][^rust-linux-only] (any version)
- memory: lambda 할당 메모리
- timeout: lambda 함수 최대 실행 시간 ( 최대 300초 까지 허용 )
- role: AWS role
- profile: AWS 프로파일명
- defaultEnvironment: 기본 인프라 환경 (stage, production 등)
- environment: lambda에 적용할 환경 변수
- nameTemplate: lambda function 만들 때 사용되는 이름 템플릿 (default: {{.Project.Name}}_{{.Function.Name}})
- retainedVersions: lambda 함수에서 유지하고 있을 버전 개수 (default: 10, 롤백용 등으로 사용함)
- vpc: AWS VPC
- vpc.securityGroups: Security Group ID 목록들
- vpc.subnets: 서브넷 ID 목록들