Search code examples
node.jsamazon-web-servicesamazon-elastic-beanstalkamazon-iam

Unable to Deploy Sample Node.js Application to AWS Elastic Beanstalk


Unable to Deploy Sample Node.js Application to AWS Elastic Beanstalk Despite Correct IAM Role Attachments

I am attempting to deploy a sample Node.js application ( Web server environment ) to AWS Elastic Beanstalk. Generally, I understand that a sample application should run without any issues. However, in my case, I am encountering a problem.

Initially, I let Elastic Beanstalk create a new role during the environment creation process. When this did not work, I manually attached additional policies to the role in an attempt to resolve the issue.

The IAM role currently has the following policies attached:

  • AWSElasticBeanstalkWebTier
  • AWSElasticBeanstalkMulticontainerDocker
  • AWSElasticBeanstalkEnhancedHealth
  • AWSElasticBeanstalkManagedUpdatesCustomerRolePolicy

Unfortunately, even after these changes, I still cannot successfully deploy the sample application.

Are there additional steps required to get the sample Node.js application running in Elastic Beanstalk? Could there be another issue I am overlooking related to the role configuration or permissions? Are there limits I may have exceeded? Or could this possibly be a service issue on AWS's end?

Any guidance or insights would be greatly appreciated.

enter image description here

Permissions

enter image description here

Permission Now enter image description here

Trust relationship

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "elasticbeanstalk.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}

Trust Relationship (Now)

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": [
                    "elasticbeanstalk.amazonaws.com",
                    "ec2.amazonaws.com"
                ]
            },
            "Action": "sts:AssumeRole"
        }
    ]
}

Solution

  • Found the problem. You have to create a different role with a name different than "aws-elasticbeanstalk-ec2-role".

    Attach the following policies:Policies for role

    Specify the following Trust Relationship: Trust relationship

    Then when creating the EB env, select it in the following box: enter image description here

    It should go as expected.

    Cheers!