Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if [ "$#" -ne 1 ]; then
- echo "Usage: ./sshhost.sh fleetid"
- exit 1
- fi
- FLEET_ID=$1
- echo Fleet Id is $FLEET_ID
- aws gamelift update-fleet-port-settings --fleet-id $FLEET_ID --inbound-permission-authorizations FromPort=22,ToPort=22,IpRange=0.0.0.0/0,Protocol=TCP 2> /dev/null
- INSTANCE_ID=$(aws gamelift describe-instances --fleet-id $FLEET_ID --output text --query 'Instances[0].InstanceId' 2> /dev/null)
- echo Instance Id is $INSTANCE_ID
- IP_ADDRESS=$(aws gamelift describe-instances --fleet-id $FLEET_ID --output text --query 'Instances[0].IpAddress' 2> /dev/null)
- echo IP Address is $IP_ADDRESS
- rm -rf /tmp/gamelift.pem
- aws gamelift get-instance-access --fleet-id $FLEET_ID --instance-id $INSTANCE_ID --output text --query 'InstanceAccess.Credentials.Secret' 2> /dev/null | tee /tmp/gamelift.pem
- chmod 400 /tmp/gamelift.pem
- echo SSHING to host at $IP_ADDRESS
- ssh -i /tmp/gamelift.pem gl-user-remote@$IP_ADDRESS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement