user3292373
user3292373

Reputation: 533

Approach required for automating launching AWS instances

I have dev environment aws template that has cloudera director installed with all vpc groups , subnet configurations, AMI's S3 bucket etc.

Now I need to establish similar environment ,automate the flow using python boto3 package

I am completely clueless how should I proceed.

Can someone help me from where should I start.

Upvotes: 0

Views: 148

Answers (2)

Yogi Devendra
Yogi Devendra

Reputation: 721

There is a Python package (the official AWS SDK for Python, AKA boto3) https://pypi.python.org/pypi/awscli which can be used for automation. AWS CLI is also based on this library. You can also try https://aws.amazon.com/cloudformation/ in which you specify json config for the resources to the REST apis provided by AWS.

Upvotes: 0

Ashan
Ashan

Reputation: 19758

There are multiple approaches to automate launching AWS EC2 instances.

  • Creating a AMI with the installed software, and using the AMI and AWS Web Console to provision new servers.
  • Creating a CloudFormation Script and having Shell Scripts(Or commandline scripts in Windows) to automate the installation of the software define in "User Data" section. Here you can re-use the CloudFormation storing in S3 for creating new instances.
  • Use AWS CLI (Shell commands with scripts) or AWS SDKs (e.g Python boto3 package) to provision the environments. For this you need to create a IAM user (Or Role, if the scripts executes inside an EC2 instance) with required permission to provision the resources.

In addition you can use a combination of these options, to make it easier to maintain. For example, if you plan to setup VPC, Network & etc. for each deployment, its better to keep the infrastructure provisioning in CloudFormation while, may be the setting up of EC2 instance written in Boto3. You can trigger the execution of both CloudFormation and other code in Boto3.

Refer the article Automating AWS With Python and Boto3 from LinuxAcademy for step by step guide.

Upvotes: 1

Related Questions