-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yml
25 lines (25 loc) · 920 Bytes
/
buildspec.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
version: 0.2
phases:
install:
runtime-versions:
python: 3.8
pre_build:
commands:
- sudo apt-get -y update
- sudo apt-get install -y python3-pip
- sudo pip install -r requirements.txt
- ASSUME_ROLE_ARN="arn:aws:iam::YOURACCOUNT:role/CentralCrossAccountAccess"
- TEMP_ROLE=$(aws sts assume-role --role-arn $ASSUME_ROLE_ARN --role-session-name test)
- export TEMP_ROLE
- export AWS_ACCESS_KEY_ID=$(echo "${TEMP_ROLE}" | jq -r '.Credentials.AccessKeyId')
- export AWS_SECRET_ACCESS_KEY=$(echo "${TEMP_ROLE}" | jq -r '.Credentials.SecretAccessKey')
- export AWS_SESSION_TOKEN=$(echo "${TEMP_ROLE}" | jq -r '.Credentials.SessionToken')
- echo INSTALL completed on `date`
build:
commands:
- echo BUILD started on `date`
- python ec2_inventory.py
- echo BUILD completed on `date`
artifacts:
files:
- "ec2_inventory.csv"