util.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/bash
  2. # Copyright 2015 The Kubernetes Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. source "${KUBE_ROOT}/cluster/aws/common/common.sh"
  16. SSH_USER=ubuntu
  17. # Detects the AMI to use for ubuntu (considering the region)
  18. #
  19. # Vars set:
  20. # AWS_IMAGE
  21. function detect-wily-image () {
  22. # This is the ubuntu 15.10 image for <region>, amd64, hvm:ebs-ssd
  23. # See here: http://cloud-images.ubuntu.com/locator/ec2/ for other images
  24. # This will need to be updated from time to time as amis are deprecated
  25. if [[ -z "${AWS_IMAGE-}" ]]; then
  26. case "${AWS_REGION}" in
  27. ap-northeast-1)
  28. AWS_IMAGE=ami-3355505d
  29. ;;
  30. ap-northeast-2)
  31. AWS_IMAGE=ami-e427e98a
  32. ;;
  33. ap-southeast-1)
  34. AWS_IMAGE=ami-60975903
  35. ;;
  36. eu-central-1)
  37. AWS_IMAGE=ami-6da2ba01
  38. ;;
  39. eu-west-1)
  40. AWS_IMAGE=ami-36a71645
  41. ;;
  42. sa-east-1)
  43. AWS_IMAGE=ami-fd36b691
  44. ;;
  45. us-east-1)
  46. AWS_IMAGE=ami-6610390c
  47. ;;
  48. us-west-1)
  49. AWS_IMAGE=ami-6e64120e
  50. ;;
  51. cn-north-1)
  52. AWS_IMAGE=ami-17a76f7a
  53. ;;
  54. us-gov-west-1)
  55. AWS_IMAGE=ami-b0bad893
  56. ;;
  57. ap-southeast-2)
  58. AWS_IMAGE=ami-3895b15b
  59. ;;
  60. us-west-2)
  61. AWS_IMAGE=ami-d95abcb9
  62. ;;
  63. *)
  64. echo "Please specify AWS_IMAGE directly (region ${AWS_REGION} not recognized)"
  65. exit 1
  66. esac
  67. fi
  68. }