forked from h2oai/h2o-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added h2o-cluster-distribute-aws-credentials.sh.
Updated AMI. Now supports S3N access.
- Loading branch information
1 parent
c15d440
commit 850cd05
Showing
4 changed files
with
104 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ -z ${AWS_ACCESS_KEY_ID} ] | ||
then | ||
echo "ERROR: You must set AWS_ACCESS_KEY_ID in the environment." | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${AWS_SECRET_ACCESS_KEY} ] | ||
then | ||
echo "ERROR: You must set AWS_SECRET_ACCESS_KEY in the environment." | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${AWS_SSH_PRIVATE_KEY_FILE} ] | ||
then | ||
echo "ERROR: You must set AWS_SSH_PRIVATE_KEY_FILE in the environment." | ||
exit 1 | ||
fi | ||
|
||
coreSiteFileName=core-site.xml | ||
rm -f ${coreSiteFileName} | ||
cat <<EOF1 > ${coreSiteFileName} | ||
<?xml version="1.0"?> | ||
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> | ||
<!-- Put site-specific property overrides in this file. --> | ||
<configuration> | ||
<!-- | ||
<property> | ||
<name>fs.default.name</name> | ||
<value>s3n://h2o-datasets</value> | ||
</property> | ||
--> | ||
<property> | ||
<name>fs.s3n.awsAccessKeyId</name> | ||
<value>${AWS_ACCESS_KEY_ID}</value> | ||
</property> | ||
<property> | ||
<name>fs.s3n.awsSecretAccessKey</name> | ||
<value>${AWS_SECRET_ACCESS_KEY}</value> | ||
</property> | ||
</configuration> | ||
EOF1 | ||
|
||
awsCredentialsPropertiesFileName=aws_credentials.properties | ||
rm -f ${awsCredentialsPropertiesFileName} | ||
cat <<EOF2 > ${awsCredentialsPropertiesFileName} | ||
accessKey=${AWS_ACCESS_KEY_ID} | ||
secretKey=${AWS_SECRET_ACCESS_KEY} | ||
EOF2 | ||
|
||
i=0 | ||
for publicDnsName in $(cat nodes-public) | ||
do | ||
i=$((i+1)) | ||
echo "Copying aws credential files to node ${i}: ${publicDnsName}" | ||
ssh -o StrictHostKeyChecking=no -i ${AWS_SSH_PRIVATE_KEY_FILE} ec2-user@${publicDnsName} mkdir -p .ec2 | ||
scp -p -o StrictHostKeyChecking=no -i ${AWS_SSH_PRIVATE_KEY_FILE} ${coreSiteFileName} ${awsCredentialsPropertiesFileName} ec2-user@${publicDnsName}:.ec2 | ||
done | ||
|
||
echo Success. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters