Make server use 127.0.0.1 as default address.
This commit is contained in:
parent
9062c654cf
commit
bf2fdbba76
17
README.md
17
README.md
@ -206,20 +206,31 @@ To run a service:
|
|||||||
|
|
||||||
```console
|
```console
|
||||||
$ moto_server ec2
|
$ moto_server ec2
|
||||||
* Running on http://0.0.0.0:5000/
|
* Running on http://127.0.0.1:5000/
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also pass the port as the second argument:
|
You can also pass the port as the second argument:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ moto_server ec2 -p3000
|
$ moto_server ec2 -p3000
|
||||||
* Running on http://0.0.0.0:3000/
|
* Running on http://127.0.0.1:3000/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you want to be able to use the server externally you can pass an IP
|
||||||
|
address to bind to as a hostname or allow any of your external
|
||||||
|
interfaces with 0.0.0.0:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ moto_server ec2 -H 0.0.0.0
|
||||||
|
* Running on http://0.0.0.0:5000/
|
||||||
|
```
|
||||||
|
|
||||||
|
Please be aware this might allow other network users to access your
|
||||||
|
server.
|
||||||
|
|
||||||
Then go to [localhost](http://localhost:5000/?Action=DescribeInstances) to see a list of running instances (it will be empty since you haven't added any yet).
|
Then go to [localhost](http://localhost:5000/?Action=DescribeInstances) to see a list of running instances (it will be empty since you haven't added any yet).
|
||||||
|
|
||||||
If you want to use boto with this (using the simpler decorators above instead is strongly encouraged), the easiest way is to create a boto config file (`~/.boto`) with the following values:
|
If you want to use boto with this (using the simpler decorators above instead is strongly encouraged), the easiest way is to create a boto config file (`~/.boto`) with the following valuesp:
|
||||||
|
|
||||||
```
|
```
|
||||||
[Boto]
|
[Boto]
|
||||||
|
@ -107,6 +107,6 @@ Moto comes with a stand-alone server allowing you to mock out an AWS HTTP endpoi
|
|||||||
.. sourcecode:: bash
|
.. sourcecode:: bash
|
||||||
|
|
||||||
$ moto_server ec2 -p3000
|
$ moto_server ec2 -p3000
|
||||||
* Running on http://0.0.0.0:3000/
|
* Running on http://127.0.0.1:3000/
|
||||||
|
|
||||||
This method isn't encouraged if you're using ``boto``, best is to use decorator method.
|
This method isn't encouraged if you're using ``boto``, best is to use decorator method.
|
||||||
|
@ -131,7 +131,7 @@ def main(argv=sys.argv[1:]):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-H', '--host', type=str,
|
'-H', '--host', type=str,
|
||||||
help='Which host to bind',
|
help='Which host to bind',
|
||||||
default='0.0.0.0')
|
default='127.0.0.1')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-p', '--port', type=int,
|
'-p', '--port', type=int,
|
||||||
help='Port number to use for connection',
|
help='Port number to use for connection',
|
||||||
|
Loading…
Reference in New Issue
Block a user