Managing AWS EC2 instances with Flexera One plugins
By managing your AWS EC2 instances in Flexera One, you can achieve better visibility, control, and optimization of your cloud resources, leading to more efficient and cost-effective operations. This article walks you through creating credentials and registering plugins, which establishes regular polling jobs that fetch data from your AWS environment to the TI Platform.
Prerequisites
To perform operations with Flexera One plugins, you'll need the Plugins/Manage cloud resources role in Flexera One.
Create credentials
-
Create your AWS credentials using the Credentials API from Flexera.
-
Note down the credential ID for future reference.
Register the plugin
Plugin registration sets up a regular polling job to fetch data from your cloud environment and send it to the TI Platform. Each AWS account and region requires its own plugin registration. The first data polling happens immediately after plugin registration and then repeats every 60 minutes.
Follow these steps to register the plugin:
-
Set up environment variables: Open your terminal and set the following environment variables:
# US Flexera One Endpoint
export cs_endpoint=https://api.flexera.com
# EU Flexera One Endpoint
#export cs_endpoint=https://api.flexera.eu
# AP Flexera One Endpoint
#export cs_endpoint=https://api.flexera.au
export cs_endpoint=https://api.flexera.com
export content_header=application/json
export user_auth_header="Authorization: Bearer <<ACCESS_TOKEN>>"
export aws_account=<<aws_account_id>>
export region=<<region>>
export credential_id=<<credential_id>>
export org_id=<<organisation_id>>
export resource=instances
export plugin_name=aws
export plugin_id=library/ec2:2.0.0
export server_url='https://ec2.{region}.amazonaws.com'
- Define parameter values: Run the following command to define the parameter values:
parameter_values="$(jq -c -n\
--argjson aws_account_number $aws_account_id \
'[
{name: "aws_account_number", value: $aws_account_number}
]')"
- Register the plugin: Use the following curl command to register the plugin:
curl -i -H "$user_auth_header" -H "$content_header" -X POST "$cs_endpoint/cloud/v1/orgs/$org_id/registrations/bulk" -d \
"$(jq -c -n \
--arg credential_id $credential_id \
--argjson parameter_values $parameter_values \
--arg plugin_id $plugin_id \
--arg server_url $server_url \
'{
configurations: [
{
credentialId: $credential_id,
parameterValues: $parameter_values,
pluginId: $plugin_id,
server: {
url: $server_url,
variableValues: [{"name": "region", "values": ["us-east-1"]}]
}
}
]
}')"