aws/scipt.sh
Michal Gulczynski 5133d0f102 first try
2024-12-16 00:40:14 +01:00

20 lines
837 B
Bash

#!/bin/bash
echo "Pobieranie danych AWS CLI..."
AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id)
AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key)
AWS_SESSION_TOKEN=$(aws sts get-session-token --duration-seconds 3600 --query 'Credentials.SessionToken' --output text)
DEFAULT_VPC=$(aws ec2 describe-vpcs --filters "Name=isDefault,Values=true" --query 'Vpcs[0].VpcId' --output text)
if [[ -z "$AWS_ACCESS_KEY_ID" || -z "$AWS_SECRET_ACCESS_KEY" || -z "$AWS_SESSION_TOKEN" || -z "$DEFAULT_VPC" ]]; then
echo "Brak wymaganych danych! Sprawdź konfigurację AWS CLI."
exit 1
fi
echo "Uruchamianie main.py..."
python3 main.py \
--aws_access_key_id "$AWS_ACCESS_KEY_ID" \
--aws_secret_access_key "$AWS_SECRET_ACCESS_KEY" \
--aws_session_token "$AWS_SESSION_TOKEN" \
--default_vpc "$DEFAULT_VPC"