Notes
Notes - notes.io |
name: invoke-lambda-for-cr
identifier: invokelambdaforcr
type: Custom
delegateSelectors:
- xxxxxxxxx
failureStrategies:
- onFailure:
errors:
- AllErrors
action:
type: Retry
spec:
retryCount: 3
retryInterval: 5m
spec:
execution:
steps:
- step:
name: assume-role-and-invoke-lambda
identifier: AssumeRoleAndInvokeLambda
type: ShellScript
timeout: 15m
spec:
shell: Bash
onDelegate: true
source:
type: Inline
spec:
script: |
# Step 1: Assume the AWS IAM role for triggering the Lambda function
temp_role=$(aws sts assume-role --role-arn arn:aws:iam::$AWS_ACCOUNT_ID:role/BB00002948_Harness_Pipeline_Role --role-session-name lambda-trigger)
export AWS_ACCESS_KEY_ID=$(echo $temp_role | jq -r .Credentials.AccessKeyId)
export AWS_SECRET_ACCESS_KEY=$(echo $temp_role | jq -r .Credentials.SecretAccessKey)
export AWS_SESSION_TOKEN=$(echo $temp_role | jq -r .Credentials.SessionToken)
export AWS_REGION=$REGION
# Step 2: Prepare the Lambda payload file with your ServiceNow data
cat <<EOF > harness_service_now_payload.json
{
"template_name": "IDT Onyx Service - Pipeline Account ODA Grant to Application Team Members",
"fields": {
"requested_by": "Cesar Ordonez",
"assigned_to": "Karthik Ramesh",
"u_conflict_justification": "No impact on critical services",
"business_service": "Investor Development Tools",
"description": "Allow new service to publish data",
"short_description": "Onyx Service Deployment",
"cmdb_ci": "Banzai",
"start_date": "$(date +%Y-%m-%d)",
"end_date": "$(date -d '+1 day' +%Y-%m-%d)"
}
}
EOF
# Step 3: Invoke the Lambda function with the prepared payload
aws lambda invoke
--function-name Onyx-servicenow
--cli-binary-format raw-in-base64-out
--payload "$(cat harness_service_now_payload.json)"
response.json
# Step 4: Check the Lambda function response
echo "Lambda function response:"
cat response.json
environmentVariables:
AWS_ACCOUNT_ID: "xxxxxxxxxxxx" # Your AWS Account ID
REGION: "us-east-1" # Your AWS Region
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team