I am trying to use T2 Unlimited instances with Elastic Beanstalk. I don't want to configure this after the instances have launched, so I am wondering if anyone knows if it's at all possible with EB configuration?
I found a solution. Posting it here in case others run into the same issue:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "InstanceCreditPolicy",
"Effect": "Allow",
"Action": [
"ec2:ModifyInstanceCreditSpecification",
"ec2:DescribeInstanceCreditSpecifications"
],
"Resource": "*"
}
]
}
.ebextensions/01-set-instance-credit-unlimited.config
)commands:
set-instance-credit-unlimited:
command: |
aws ec2 modify-instance-credit-specification --region <your_region> --instance-credit-specification '[{"InstanceId": "'"$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-id)"'","CpuCredits": "unlimited"}]'
In case you're using solution stack- "64bit Amazon Linux 2017.03 v4.1.1 running Node.js", in addition to creating the policy described by user steinim, you need to use these two config files instead:
1) upgrade-awscli.config
commands:
modify-instance-credit-specification:
command: "sudo pip install --upgrade awscli"
2) t2-unlimited-test.config
commands:
modify-instance-credit-specification:
command: "aws ec2 modify-instance-credit-specification --region us-west-2 --instance-credit-specification '[{\"InstanceId\": \"'\"$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-id)\"'\",\"CpuCredits\": \"unlimited\"}]'"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With