8000 Implement EC2 support through Moto by brettneese · Pull Request #1363 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

Implement EC2 support through Moto #1363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ADD bin/supervisord.conf /etc/supervisord.conf
ADD bin/docker-entrypoint.sh /usr/local/bin/

# expose service & web dashboard ports
EXPOSE 4567-4593 8080
EXPOSE 4567-4597 8080

# define command at startup
ENTRYPOINT ["docker-entrypoint.sh"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ any longer.
* **CloudWatch Logs** at http://localhost:4586
* **STS** at http://localhost:4592
* **IAM** at http://localhost:4593

* **EC2** at http://localhost:4597

Additionally, *LocalStack* provides a powerful set of tools to interact with the cloud services, including
a fully featured KCL Kinesis client with Python binding, simple setup/teardown integration for nosetests, as
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
localstack:
image: localstack/localstack
ports:
- "4567-4593:4567-4593"
- "4567-4593:4567-4597"
- "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}"
environment:
- SERVICES=${SERVICES- }
Expand Down
2 changes: 1 addition & 1 deletion localstack/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import localstack_client.config

# LocalStack version
VERSION = '0.9.4'
VERSION = '0.9.5'

# default AWS region
if 'DEFAULT_REGION' not in os.environ:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ public static String getEndpointStepFunctions() {
return ensureInstallationAndGetEndpoint(ServiceName.STEPFUNCTIONS);
}

public static String getEndpointEC2() {
return ensureInstallationAndGetEndpoint(ServiceName.EC2);
}


/* UTILITY METHODS */

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ public class ServiceName {
public static final String SSM = "ssm";
public static final String SECRETSMANAGER = "secretsmanager";
public static final String STEPFUNCTIONS = "stepfunctions";
public static final String EC2 = "ec2";

}
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ public String getEndpointSSM() {
public String getEndpointSecretsmanager() {
return endpointForService(ServiceName.SECRETSMANAGER);
}

public String getEndpointEC2() {
return endpointForService(ServiceName.EC2);
}

public String getEndpointStepFunctions() { return endpointForService(ServiceName.STEPFUNCTIONS); }

Expand Down
4 changes: 3 additions & 1 deletion localstack/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from localstack.services.infra import (register_plugin, Plugin,
start_sns, start_ses, start_apigateway, start_elasticsearch_service, start_lambda,
start_redshift, start_firehose, start_cloudwatch, start_dynamodbstreams, start_route53,
start_ssm, start_sts, start_secretsmanager, start_iam, start_cloudwatch_logs)
start_ssm, start_sts, start_secretsmanager, start_iam, start_cloudwatch_logs, start_ec2)
from localstack.services.kinesis import kinesis_listener, kinesis_starter
from localstack.services.dynamodb import dynamodb_listener, dynamodb_starter
from localstack.services.apigateway import apigateway_listener
Expand Down Expand Up @@ -76,6 +76,8 @@ def register_localstack_plugins():
register_plugin(Plugin('stepfunctions',
start=stepfunctions_starter.start_stepfunctions,
listener=stepfunctions_listener.UPDATE_STEPFUNCTIONS))
register_plugin(Plugin('ec2',
start=start_ec2))
except Exception as e:
print('Unable to register plugins: %s' % e)
sys.stdout.flush()
Expand Down
5 changes: 5 additions & 0 deletions localstack/services/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ def start_secretsmanager(port=None, asynchronous=False):
return start_moto_server('secretsmanager', port, name='Secrets Manager', asynchronous=asynchronous)


def start_ec2(port=None, asynchronous=False):
port = port or config.PORT_EC2
return start_moto_server('ec2', port, name='EC2', asynchronous=asynchronous)


# ---------------
# HELPER METHODS
# ---------------
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ flask-cors==3.0.3
flask_swagger==0.2.12
jsonpath-rw==1.4.0
localstack-ext>=0.8.6
localstack-client==0.8
localstack-client==0.9
moto-ext>=1.3.7.1
nose>=1.3.7
psutil==5.4.8
Expand Down
0