Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9142729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:50:58+00:00 2026-06-17T09:50:58+00:00

I have included some code that uploads a war file into an s3 bucket

  • 0

I have included some code that uploads a war file into an s3 bucket (creating the bucket first if it does not exist). It then creates an elastic beanstalk application version using the just-uploaded war file.

Assume /tmp/server_war exists and is a valid war file. The following code will fail with boto.exception.BotoServerError: BotoServerError: 400 Bad Request:

#!/usr/bin/env python

import time

import boto

BUCKET_NAME = 'foo_bar23498'

s3 = boto.connect_s3()
bucket = s3.lookup(BUCKET_NAME)
if not bucket:
  bucket = s3.create_bucket(BUCKET_NAME, location='')

version_label = 'server%s' % int(time.time())

# uplaod the war file
key_name = '%s.war' % version_label
s3key = bucket.new_key(key_name)
print 'uploading war file...'
s3key.set_contents_from_filename('/tmp/server.war',
                                 headers={'Content-Type' : 'application/x-zip'})

# uses us-east-1 by default
eb = boto.connect_beanstalk()

eb.create_application_version(
  application_name='TheApp', 
  version_label=version_label, 
  s3_bucket=BUCKET_NAME, 
  s3_key=key_name, 
  auto_create_application=True)

what would cause this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:51:00+00:00Added an answer on June 17, 2026 at 9:51 am

    One possible cause of this error is the bucket name. Apparently you can have s3 bucket names that contain underscores, but you cannot create application versions using keys in those buckets.

    If you change the fourth line above to

    BUCKET_NAME = ‘foo-bar23498’

    It should work.

    Yes, it feels weird to be answering my own question…apparently this the recommended approach for this situation on stack overflow. I hope I save someone else a whole lot of debugging time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below I have included my code that uploads multiple images to a folder and
At this present point in time I have some code that does the following:
Quick question about include/requre_once . I have some code that is common to a
I have some code that listens for announcements via UDP multicast. I can get
I have a Firebase app that works perfectly on localhost, but does not work
I have some code that finds a keyword in an array (clues) and returns
I have some code (that is working), but I just want to make sure
I have some code that needs Unicode strings for the most part, but I
I asked a similar question yesterday but I included some code that basically took
I have some code that uses JavaScript templates to create some HTML, including some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.