forked from openremote/openremote
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheks-common.sh
More file actions
executable file
·47 lines (36 loc) · 1.81 KB
/
Copy patheks-common.sh
File metadata and controls
executable file
·47 lines (36 loc) · 1.81 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
if [ -z "$AWS_ACCOUNT_ID" ]; then
echo "Error: AWS_ACCOUNT_ID environment variable is not set"
echo "Please set it to the ID of the account you want to deploy the cluster into with: export AWS_ACCOUNT_ID=your-account-id"
exit 1
fi
if [ -z "$AWS_DEVELOPERS_ACCOUNT_ID" ]; then
echo "Error: $AWS_DEVELOPERS_ACCOUNT_ID environment variable is not set"
echo "Please set it to the ID of the OpenRemote developers root account with: export AWS_DEVELOPERS_ACCOUNT_ID=dev-account-id"
exit 1
fi
set -eo pipefail
# Name of cluster, not exposed but must be unique within account
export CLUSTER_NAME=testcluster
# Hostname to use for public access to this instance, always under the openremote.app domain
HOSTNAME=testmanager
FQDN=$HOSTNAME.openremote.app
MQTT_FQDN=mqtt.$FQDN
MQTTS_FQDN=mqtts.$FQDN
export AWS_REGION="eu-west-1"
DNSCHG_ROLE_ARN="arn:aws:iam::$AWS_DEVELOPERS_ACCOUNT_ID:role/route53-full-access"
aws configure set region $AWS_REGION
aws configure --profile or set region $AWS_REGION
aws configure --profile or set output json
aws configure --profile dnschg set source_profile or
aws configure --profile dnschg set role_arn $DNSCHG_ROLE_ARN
if [ -n "$AWS_ACCESS_KEY_ID" ]; then
aws configure --profile or set aws_access_key_id $AWS_ACCESS_KEY_ID
fi
if [ -n "$AWS_SECRET_ACCESS_KEY" ]; then
aws configure --profile or set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
fi
if [ -n "$AWS_SESSION_TOKEN" ]; then
aws configure --profile or set aws_session_token $AWS_SESSION_TOKEN
fi
aws sts assume-role --role-arn $DNSCHG_ROLE_ARN --role-session-name dnschg --profile or --query "Credentials.[AccessKeyId, SecretAccessKey, SessionToken]" --output text | awk -F'\t' '{print "aws_access_key_id "$1"\naws_secret_access_key "$2"\naws_session_token "$3 }' | xargs -L 1 aws configure --profile dnschg set