0
votes

To deploy the USA AWS beanstalk environment in China EC2 instance, I use the following shell command:

[root@ip-10-0-0-1 ~]#echo -e "[profile eb-cli]\naws_access_key_id = 123\naws_secret_access_key = 234" > /root/.aws/config 
[root@ip-10-0-0-1 ~]#echo -e "[profile eb-cli]\naws_access_key_id = 123\naws_secret_access_key = 234" > /root/.aws/credentials 
[root@ip-10-0-0-1 ~]#eb init worldcup --region us-west-1 --platform "arn:aws:elasticbeanstalk:us-west-1::platform/Tomcat 8 with Java 8 running on 64bit Amazon Linux/2.7.7" 
[root@ip-10-0-0-1 ~]#eb deploy "worldcup-dev" --version 6ad83ed9f599a8c9c967ef2f7168127f8dee2123-675

It's finished.

Then I use aws access key in Chinese region to get the platform information of china aws beanstalk specified environment:

[root@ip-10-0-0-1 ~]#echo -e "[profile eb-cli]\naws_access_key_id = 456\naws_secret_access_key = 789" > /root/.aws/config 
[root@ip-10-0-0-1 ~]#echo -e "[profile eb-cli]\naws_access_key_id = 456\naws_secret_access_key = 789" > /root/.aws/credentials 
[root@ip-10-0-0-1 ~]#eb use chinacup-dev --region cn-north-1
[root@ip-10-0-0-1 ~]#eb platform show --region cn-north-1

ERROR: InvalidParameterValueError - Platform 'arn:aws:elasticbeanstalk:us-west-1::platform/Tomcat 8 with Java 8 running on 64bit Amazon Linux/2.7.7' is in a different region.

How should I solve the above problem ?

1

1 Answers

1
votes

The problem is that arn:aws:elasticbeanstalk:us-west-1::platform/Tomcat 8 with Java 8 running on 64bit Amazon Linux/2.7.7 is not valid in cn-north-1.

Open .elasticbeanstalk/config.yml and change the default_platform to the equivalent platform ARN in the cn-north-1 region. You can find the equivalent platform ARN in the cn-north-1 region by executing:

aws elasticbeanstalk list-platform-versions --region cn-north-1 --filters "Type=PlatformName,Operator='contains',Values='Tomcat 8'" | grep "PlatformArn"