1

I have deployed a python flask application in EC2 instance.

Now i need to create autoscaling groups so that if some parameter is high i need EC2 to spin up automatically with the flask application.

I can create an AMI of the current EC2 instance and associate IAM role to launch template(autoscaling group).Is this the best practice?

2 Answers 2

1

Yes you would have an AMI (often referred to as Golden AMI or prebaked AMI) that your launch configuration / launch template would reference and autoscale.

If you want to improve this further you could look at setting up Code Deploy so that the latest version code can be deployed to all instances in the autoscaling group without needing to rebuild another golden AMI.

Sign up to request clarification or add additional context in comments.

Comments

-1

You may want to try AWS Chalice. It's like flask but it automatically wires up to an api gateway and lambda.

https://aws.github.io/chalice/quickstart.html

It may simplify a lot of the deployment for you although lambda obviously comes with some resource constraints. The python looks like this;

from chalice import Chalice

app = Chalice(app_name='helloworld')


@app.route('/')
def index():
    return {'hello': 'world'}

The deploy is simply chalice new-project helloworld and then chalice deploy.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.