AWS invalid literal for int() with base 8: ‘493’

Working on an AWS Elastic Beanstalk deployment, I’m using a .config file in my project’s .ebextensions folder to create and upload a file (see the Development Duide). The deployment fails with this message:

Error occurred during build: invalid literal for int() with base 8: ‘493’

I pulled a more complete error trace from /var/log/cfn-init.log:

[ERROR] Unhandled exception during build: invalid literal for int() with base 8: '493'
Traceback (most recent call last):
  File "/opt/aws/bin/cfn-init", line 122, in <module>, configSets)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/", line 117, in build
    Contractor(metadata).build(configSets, self)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/", line 502, in build
    self.run_config(config, worklog)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/", line 511, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/", line 238, in build
    changes['files'] = FileTool().apply(self._config.files, self._auth_config)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/", line 102, in apply
    file_is_link = "mode" in attribs and stat.S_ISLNK(int(attribs["mode"], 8))
ValueError: invalid literal for int() with base 8: '493'

The clue I needed was in the second-to-last line:  it didn’t like the “mode” I specified for the file, apparently complaining that 493 is not a base-8 value (which is true:  base 8 has digits 0 through 7). Here’s my .config file:

  "/etc/my-file" :
    mode: 000755
    owner: root
    group: root

          type: S3
          roleName: aws-elasticbeanstalk-ec2-role
          buckets: mybucket

For some reason, it converted 000755 to 493 decimal (base 10), then it tried to interpret it as base 8.

Use Quotation Marks for Mode

The fix? Enclose the mode in quotation marks (which is in fact the way it is shown in the Development Guide examples):

  "/etc/my-file" :
    mode: "000755"

With that change, the deployment worked and the file was successfully transferred from S3 to my EC2 instance.

P.S. Credit for the “Resources” section that allows downloading from secured S3 goes to the May 7, 2014 post by Joshua@AWS to this thread.

6 thoughts on “AWS invalid literal for int() with base 8: ‘493’

  1. Akshay Singhvi

    Thank you, you saved a ton of time!

  2. Brice

    Wow !! Thank you so very much !!
    You prevented me from banging my head against my desk…

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.

This site uses Akismet to reduce spam. Learn how your comment data is processed.