SG-AWS How to map awsRegion to Location field ?

heptane
Tera Contributor

I have setup service graph connector for AWS in non-prod, there is Location field in cmdb on server table, basically referenced. How do I map awsRegion to it. I saw I have to do some customization in temp entity using Ec2 data source but how.

#serviceGraphConnectorForAws

#sg-aws

#aws

 

1 REPLY 1

heptane
Tera Contributor

I got answer myself, putting here if anyone needs it.

So Location field is present on Server form and list view in my instance which actually is looked up on cmn_location table.

 

I read about associative class, reference variables etc. which it is said we can use through IntegrationHub ETL but I couldn't find.

What I found is we have awsRegion variable already provided in the temp.

So I went to IntHub etl, selected SG-AWS and picked EC2 data source.

Then Created New Transform using awsRegion and script operation since in the Location (cmn_location) table I have locations like AWS London, AWS Ireland etc. but region field is like us-east-1 etc. 

So from here 2 possibilities:

1.) Either add values like us-east-1 etc. in location table and use direct CI Lookup transform over awsRegion column 

2.) Write Script to convert values from for example us-west-2 to AWS Oregon.

 

I chose second method and wrote simple JavaScript code to convert the value.

 

Here comes the part I eas stuck on for long for which I ased the question on the community. I was able to fetch and return the correct value, as I could see correct value in the staging table, but on running transform [Empty] value was stored in the location field. 

For testing when I returned it to comment field, I could see the correct value.

The solution which I got is when I tested running some Background Scripts which tells you have to return sys_id instead of name of the location record.

For doing it either return sys_id direct in your Script transform by manually finding in cmn_location table and map to awsRegion or use GlideRecord Queries.

 

After making changes to the Script accordingly we can see sys_id in the column in staging table, go to next step in IntHub ETL and find mapping for Server1, create new varible of Location and map to the column you made using Script. Click Next, ok etc. and run Test, you may see the correct values there.

 

If you are unable have or use IntHub etl make sure you have installed the Integration Hub ETL plugin and search for full name instead of just IntegrationHub.

Although, there is another way to make mapping without it as well, would write some other time.

PS: wrote from phone, might've made typos, suggestions are welcome.