diff --git a/aws-code/spot-instance/create_launch_specs.py b/aws-code/spot-instance/create_launch_specs.py index c55c6a92e..57423c6b7 100644 --- a/aws-code/spot-instance/create_launch_specs.py +++ b/aws-code/spot-instance/create_launch_specs.py @@ -12,7 +12,7 @@ REGION_HUMAN_NAME = 'region_human_name' INSTANCE_TYPE = 'm3.medium' # 't2.micro' AMI = 'ami-f2d3638a' # 'ami-a9d09ed1' # base64 userdata.sh -USER_DATA = 'IyEvYmluL2Jhc2gKeXVtIC15IHVwZGF0ZQp5dW0gaW5zdGFsbCAteSBydWJ5CmNkIC9ob21lL2VjMi11c2VyCmN1cmwgLU8gaHR0cHM6Ly9hd3MtY29kZWRlcGxveS11cy13ZXN0LTIuczMuYW1hem9uYXdzLmNvbS9sYXRlc3QvaW5zdGFsbApjaG1vZCAreCAuL2luc3RhbGwKLi9pbnN0YWxsIGF1dG8=' +USER_DATA = 'IyEvYmluL2Jhc2gKUkVHSU9OPSQoY3VybCAxNjkuMjU0LjE2OS4yNTQvbGF0ZXN0L21ldGEtZGF0YS9wbGFjZW1lbnQvYXZhaWxhYmlsaXR5LXpvbmUvIHwgc2VkICdzL1thLXpdJC8vJykKeXVtIC15IHVwZGF0ZQp5dW0gaW5zdGFsbCAteSBydWJ5CmNkIC9ob21lL2VjMi11c2VyCmN1cmwgLU8gaHR0cHM6Ly9hd3MtY29kZWRlcGxveS0kUkVHSU9OLnMzLmFtYXpvbmF3cy5jb20vbGF0ZXN0L2luc3RhbGwKY2htb2QgK3ggLi9pbnN0YWxsCi4vaW5zdGFsbCBhdXRv' IAM_INSTANCE_PROFILE = 'BenchMarkCodeDeployInstanceProfile' def read_configuration_file(filename): diff --git a/aws-code/spot-instance/userdata.sh b/aws-code/spot-instance/userdata.sh index bd18cd23c..3a64eddf9 100644 --- a/aws-code/spot-instance/userdata.sh +++ b/aws-code/spot-instance/userdata.sh @@ -1,7 +1,8 @@ #!/bin/bash +REGION=$(curl 169.254.169.254/latest/meta-data/placement/availability-zone/ | sed 's/[a-z]$//') yum -y update yum install -y ruby cd /home/ec2-user -curl -O https://aws-codedeploy-us-west-2.s3.amazonaws.com/latest/install +curl -O https://aws-codedeploy-$REGION.s3.amazonaws.com/latest/install chmod +x ./install ./install auto \ No newline at end of file