@brunwig/mup-aws-beanstalk 2.0.5 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/assets/env.sh +22 -3
  2. package/package.json +1 -1
package/lib/assets/env.sh CHANGED
@@ -10,9 +10,28 @@ echo "env_version=$env_version"
10
10
  export NVM_DIR="/.nvm"
11
11
  [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
12
12
 
13
- instance_profile=`curl http://169.254.169.254/$VERSION/meta-data/iam/security-credentials/`
14
- json=`curl http://169.254.169.254/$VERSION/meta-data/iam/security-credentials/${instance_profile}`
15
- instance_region=`curl http://169.254.169.254/latest/meta-data/placement/availability-zone | sed 's/.$//'`
13
+ # instance_profile=`curl http://169.254.169.254/$VERSION/meta-data/iam/security-credentials/`
14
+ # json=`curl http://169.254.169.254/$VERSION/meta-data/iam/security-credentials/${instance_profile}`
15
+ # instance_region=`curl http://169.254.169.254/latest/meta-data/placement/availability-zone | sed 's/.$//'`
16
+
17
+ # Get an IMDSv2 token (valid for 6 hours here)
18
+ TOKEN=$(curl -sS -X PUT "http://169.254.169.254/latest/api/token" \
19
+ -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
20
+
21
+ # Instance profile (role name)
22
+ instance_profile=$(curl -sS -H "X-aws-ec2-metadata-token: $TOKEN" \
23
+ http://169.254.169.254/latest/meta-data/iam/security-credentials/)
24
+
25
+ # Temp credentials JSON for that profile
26
+ json=$(curl -sS -H "X-aws-ec2-metadata-token: $TOKEN" \
27
+ http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile})
28
+
29
+ # Region (strip last letter from AZ)
30
+ instance_region=$(curl -sS -H "X-aws-ec2-metadata-token: $TOKEN" \
31
+ http://169.254.169.254/latest/meta-data/placement/availability-zone | sed 's/.$//')
32
+
33
+ echo "instance_profile: ${instance_profile}"
34
+ echo "instance_region: ${instance_region}"
16
35
 
17
36
  function getInstanceProfileProperty () {
18
37
  result=`node -e "console.log(JSON.parse(process.argv.slice(2).join(''))[process.argv[1]])" $1 $json`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brunwig/mup-aws-beanstalk",
3
- "version": "2.0.5",
3
+ "version": "2.1.0",
4
4
  "type": "commonjs",
5
5
  "description": "Deploy apps to AWS Elastic Beanstalk using Meteor Up",
6
6
  "main": "index.js",