sample
turbot/flowpipe-samples/query-and-stop-aws-ec2-instances-by-tag

Query and Stop AWS EC2 Instances by Tag

Query a list of running AWS EC2 instances with the tag key-value pair status: decom using Steampipe and then stop them.

Installation

Download and install Flowpipe (https://flowpipe.io/downloads). Or use Brew:

brew tap turbot/tap
brew install flowpipe

Clone:

git clone https://github.com/turbot/flowpipe-samples.git
cd public_cloud/query_and_stop_aws_ec2_instance

Install mod dependencies:

flowpipe mod install

Connections

By default, the following environment variables will be used for authentication:

  • AWS_PROFILE
  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_PROFILE

You can also create connection resources in configuration files:

vi conns.fpc
connection "aws" "aws_profile" {
profile = "my-profile"
}
connection "aws" "aws_access_key_pair" {
access_key = "AKIA..."
secret_key = "dP+C+J..."
}
connection "aws" "aws_session_token" {
access_key = "AKIA..."
secret_key = "dP+C+J..."
session_token = "AQoDX..."
}

For more information on connections in Flowpipe, please see Managing Connections.

Usage

Run the pipeline and specify the aws_region pipeline arguments:

flowpipe pipeline run query_and_stop_aws_ec2_instance --arg aws_region=us-east-1

Configuration

To avoid entering variable values when running the pipeline or starting the server, you can set variable values:

cp flowpipe.fpvars.example flowpipe.fpvars
vi flowpipe.fpvars
# Optional
# aws_conn = "non_default_conn"

Open Source & Contributing

This repository is published under the Apache 2.0 license. Please see our code of conduct. We look forward to collaborating with you!

Flowpipe is a product produced from this open source software, exclusively by Turbot HQ, Inc. It is distributed under our commercial terms. Others are allowed to make their own distribution of the software, but cannot use any of the Turbot trademarks, cloud services, etc. You can learn more in our Open Source FAQ.

Get Involved

Join #flowpipe on Slack →

Want to help but not sure where to start? Pick up one of the help wanted issues: