Service - AWS Resource Management: Difference between revisions
mNo edit summary |
mNo edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= Overview = | = Overview = | ||
AWSResourceManagement is a comprehensive service designed to clear caches for functions used in other services, ensuring consistently high performance and reliability across the system. By systematically removing outdated data and reloading relevant configurations, this service helps maintain accurate, up-to-date information in each function it manages. Whether you need to integrate new settings or refresh existing components, AWSResourceManagement streamlines cache operations to enhance overall efficiency and stability throughout your infrastructure. | AWSResourceManagement is a comprehensive service designed to clear caches for functions used in other services, ensuring consistently high performance and reliability across the system. By systematically removing outdated data and reloading relevant configurations, this service helps maintain accurate, up-to-date information in each function it manages. Whether you need to integrate new settings or refresh existing components, AWSResourceManagement streamlines cache operations to enhance overall efficiency and stability throughout your infrastructure. | ||
= Example = | = Example = | ||
Line 23: | Line 20: | ||
== AWSRMTestFunction == | == AWSRMTestFunction == | ||
'''Description:''' Invokes an asynchronous AWS Lambda function. | |||
<br>'''Parameters:''' | |||
* '''serviceTag''' (string): Name of the ServiceTag. | |||
* '''functionName''' (string): Name of the function to invoke within the service. | |||
<source lang="json"> | <source lang="json"> | ||
{ | { | ||
Line 42: | Line 39: | ||
</source> | </source> | ||
'''CASE Fail''' | '''CASE Fail''' | ||
<br>CASE if YourFuntionNameTarget is missing in s3 LambdaFunctions. | <br>CASE if YourFuntionNameTarget is missing in s3 <code>LambdaFunctions.json</code> | ||
<br>errorFounds return functionName | <br>errorFounds return functionName | ||
<source lang="json"> | <source lang="json"> | ||
Line 59: | Line 56: | ||
== AWSRMTestFunctions == | == AWSRMTestFunctions == | ||
'''Description:''' This function invokes multiple Lambda functions per service to clear their caches and initiate cold starts, ensuring they reload the latest configurations. This enables efficient cache management and simultaneous updates across your services. | |||
<br>'''Parameters:''' | |||
*'''clearLambdaList''' (array of objects, required): List of services and their corresponding Lambda functions to invoke. | |||
**'''serviceTag''' (string, required): Name of the ServiceTag. | |||
**'''functionNames''' (string, required): Names of the functions to invoke within the service. | |||
<source lang="json"> | <source lang="json"> | ||
{ | { | ||
Line 83: | Line 80: | ||
} | } | ||
</source> | </source> | ||
''' | '''OUTPUT: CASE Success''' | ||
'''CASE Success''' | <source lang="json"> | ||
{ | |||
"status": "complete", | |||
"errorFounds": [] | |||
} | |||
</source> | |||
'''OUTPUT: CASE Fail''' | |||
<br>CASE if YourFuntionNameTarget is missing in s3 <code>LambdaFunctions.json</code> | |||
<br>errorFounds return functionName | |||
<source lang="json"> | |||
{ | |||
"status": "error", | |||
"errorFounds": ["YourFuntionNameTarget"] | |||
} | |||
</source> | |||
CASE LambdaFunctions.json is Missing in s3 | |||
<source lang="json"> | |||
{ | |||
"status": "error", | |||
"errorFounds": ["LambdaFunctions.json not found"] | |||
} | |||
</source> | |||
'''OUTPUT: CASE anyone is successful''' | |||
<source lang="json"> | |||
{ | |||
"status": "complete", | |||
"errorFounds": ["YourFuntionNameTarget1"] | |||
} | |||
</source> | |||
== AWSRMTestService == | |||
'''Description:''' This function invokes Lambda functions to clear caches for all functions within a service, initiating cold starts to ensure they reload the latest configurations. This enables efficient cache management and simultaneous updates across the entire service. | |||
<br>'''Parameters:''' | |||
*'''serviceTag''' (string, required): Name of the ServiceTag. | |||
<source lang="json"> | |||
{ | |||
"serviceTag": "YourServiceTagTarget" | |||
} | |||
</source> | |||
'''OUTPUT: CASE Success''' | |||
<source lang="json"> | <source lang="json"> | ||
{ | { | ||
Line 91: | Line 127: | ||
} | } | ||
</source> | </source> | ||
'''CASE Fail''' | '''OUTPUT: CASE Fail''' | ||
<br>CASE if YourFuntionNameTarget is missing in s3 LambdaFunctions.json | <br>CASE if YourFuntionNameTarget is missing in s3 <code>LambdaFunctions.json</code> | ||
<br>errorFounds return functionName | <br>errorFounds return functionName | ||
<source lang="json"> | <source lang="json"> | ||
Line 107: | Line 143: | ||
} | } | ||
</source> | </source> | ||
'''OUTPUT: CASE anyone is successful''' | |||
<br> S3 LambdaFunctions Found FunctionName: ["YourFuntionNameTarget1", "YourFuntionNameTarget2"] | |||
<br> if YourFuntionNameTarget1 is fail and YourFuntionNameTarget2 is Success | |||
<source lang="json"> | |||
{ | |||
"status": "complete", | |||
"errorFounds": ["YourFuntionNameTarget1"] | |||
} | |||
</source> | |||
== AWSRMTestServices == | |||
'''Description:''' This function invokes Lambda functions to clear caches for all functions within multiple services, initiating cold starts so they reload the latest configurations. This enables efficient cache management and simultaneous updates across all specified services. | |||
<br>'''Parameters:''' | |||
*'''clearLambdaList''' (array of objects, required): List of services and their corresponding Lambda functions to invoke. | |||
**'''serviceTag''' (array of strings, required): Names of the ServiceTags. | |||
<source lang="json"> | |||
{ | |||
"clearLambdaList": { | |||
"serviceTags": [ | |||
"YourServiceTagTarget1", | |||
"YourServiceTagTarget2" | |||
] | |||
} | |||
} | |||
</source> | |||
'''OUTPUT: CASE Success''' | |||
<source lang="json"> | |||
{ | |||
"status": "complete", | |||
"errorFounds": [] | |||
} | |||
</source> | |||
'''OUTPUT: CASE Fail''' | |||
<br>CASE YourServiceTagTarget1 & YourServiceTagTarget2 is missing <code>LambdaFunctions.json</code> in s3 | |||
<source lang="json"> | |||
{ | |||
"status": "error", | |||
"errorFounds": [ | |||
"LambdaFunctions not found for service tag: service1", | |||
"LambdaFunctions not found for service tag: service2" | |||
] | |||
} | |||
</source> | |||
Error detected in the following functions: | |||
<br> * Function: YourFunctionNameTarget1 (Service: YourServiceTagTarget1) | |||
<br> * Function: YourFunctionNameTarget2 (Service: YourServiceTagTarget2) | |||
<source lang="json"> | |||
{ | |||
"status": "error", | |||
"errorFounds": ["ํYourFunctionNameTarget1", "YourFunctionNameTarget2"] | |||
} | |||
</source> | |||
'''OUTPUT: CASE anyone is successful''' | |||
<br> Error detected in the following functions: | |||
<br> * Function: YourFunctionNameTarget1 (Service: YourServiceTagTarget1) | |||
<br> * Function: YourFunctionNameTarget2 (Service: YourServiceTagTarget2) | |||
<br> * if YourFuntionNameTarget1 is fail and YourFuntionNameTarget2 is Success | |||
<source lang="json"> | |||
{ | |||
"status": "complete", | |||
"errorFounds": ["YourFuntionNameTarget1"] | |||
} | |||
</source> | |||
== AWSRMTestAddAllRole == | |||
'''Description''': This function is invoked without input. Upon invocation, it retrieves all roles from each service’s <code>LambdaFunction.json</code> and adds them to the functions <code>AWSRMTestFunction</code>, <code>AWSRMTestFunctions</code>, <code>AWSRMTestService</code>, and <code>AWSRMTestServices</code> for cache clearing. This process ensures the necessary roles are granted to perform cache-clearing tasks effectively. | |||
==AWSRMTestAddAllRole== | |||
'''Description''': This function is invoked without input. Upon invocation, it retrieves all roles from each service’s <code>LambdaFunction.json</code> and adds them to the functions <code>AWSRMTestFunction</code>, <code>AWSRMTestFunctions</code>, <code>AWSRMTestService</code>, and <code>AWSRMTestServices</code> for cache clearing. This process ensures the necessary roles are granted to perform cache-clearing tasks effectively. | |||
<br>'''Parameters:''' | |||
* '''clearLambdaList''': (array of objects, required): Specifies which services to process for role addition. | |||
** '''serviceTags''' (array of strings, required): Identifies the services from which roles will be added to <code>AWSRMTestFunction</code>, <code>AWSRMTestFunctions</code>, <code>AWSRMTestService</code>, and <code>AWSRMTestServices</code> for cache-clearing capabilities. | |||
<source lang="json"> | |||
{ | |||
"clearLambdaList": { | |||
"serviceTags": [ | |||
"YourServiceTagTarget1", | |||
"YourServiceTagTarget2" | |||
] | |||
} | |||
} | |||
</source> | |||
'''OUTPUT: CASE Success''' | |||
<source lang="json"> | |||
{ | |||
"status": "complete", | |||
"errorFounds": [] | |||
} | |||
</source> | |||
'''OUTPUT: CASE Fail''' | |||
<br>CASE Not Found <code>LambdaFunctions.json</code> | |||
<source lang="json"> | |||
{ | |||
"status": "error", | |||
"errorFounds": [ | |||
"LambdaFunctions.json not found for serviceTag: YourServiceTagTarget1", | |||
"LambdaFunctions.json not found for serviceTag: YourServiceTagTarget2" | |||
] | |||
} | |||
</source> | |||
CASE Can't CleanCacha After AddRole | |||
<br> * Function: YourFunctionNameTarget1 (Service: YourServiceTagTarget1) | |||
<br> * Function: YourFunctionNameTarget2 (Service: YourServiceTagTarget2) | |||
<source lang="json"> | |||
{ | |||
"status": "error", | |||
"errorFounds": ["ํLambdaService.clearCacheAll failed"] | |||
} | |||
</source> | |||
'''OUTPUT: CASE anyone is successful''' | |||
<br> CASE Found YourServiceTagTarget1 is not Found LambdaFunctions.json | |||
<source lang="json"> | |||
{ | |||
"status": "complete", | |||
"errorFounds": ["LambdaFunctions.json not found for serviceTag: YourServiceTagTarget1"] | |||
} | |||
</source> | |||
= Best Practices = | |||
* '''Validate Inputs:''' Always ensure that the input provided to the fambda and lambda functions is of the expected type and within acceptable ranges. | |||
* Ensure that the <code>UploadSchemaHdrInv</code> function is invoked because the AWS Resource Management service requires a permission role and the <code>LambdaFunctions.json</code> file to use the Lambda function. | |||
[[Category:Backend services| AWS Resource Management]] | |||
Latest revision as of 06:50, 23 December 2024
Overview
AWSResourceManagement is a comprehensive service designed to clear caches for functions used in other services, ensuring consistently high performance and reliability across the system. By systematically removing outdated data and reloading relevant configurations, this service helps maintain accurate, up-to-date information in each function it manages. Whether you need to integrate new settings or refresh existing components, AWSResourceManagement streamlines cache operations to enhance overall efficiency and stability throughout your infrastructure.
Example
Example usage of the lambda function:
const result = await lambda.invokeAsync(
event._izContext,
lambdaSharedLib.lambdaFunctionName('Function', AWSRM),
{
"serviceTag": "YourServiceTagTarget",
"functionName": "YourFunctionNameTarget"
}
);
Lambda Functions
The AWS Resource Management service includes six lambda functions to clean up the cache:
AWSRMTestFunction
Description: Invokes an asynchronous AWS Lambda function.
Parameters:
- serviceTag (string): Name of the ServiceTag.
- functionName (string): Name of the function to invoke within the service.
{
"serviceTag": "YourServiceTagTarget",
"functionName": "YourFunctionNameTarget"
}
Output: CASE Success
{
"status": "complete",
"errorFounds": []
}
CASE Fail
CASE if YourFuntionNameTarget is missing in s3 LambdaFunctions.json
errorFounds return functionName
{
"status": "error",
"errorFounds": ["YourFuntionNameTarget"]
}
CASE LambdaFunctions.json is Missing in s3
{
"status": "error",
"errorFounds": ["LambdaFunctions.json not found"]
}
AWSRMTestFunctions
Description: This function invokes multiple Lambda functions per service to clear their caches and initiate cold starts, ensuring they reload the latest configurations. This enables efficient cache management and simultaneous updates across your services.
Parameters:
- clearLambdaList (array of objects, required): List of services and their corresponding Lambda functions to invoke.
- serviceTag (string, required): Name of the ServiceTag.
- functionNames (string, required): Names of the functions to invoke within the service.
{
"clearLambdaList":[
{
"serviceTag":"YourServiceTagTarget1",
"functionNames":[
"YourFuntionNameTarget1",
"YourFuntionNameTarget2"
]
},
{
"serviceTag":"YourServiceTagTarget2",
"functionNames":[
"YourFuntionNameTarget1"
]
}
]
}
OUTPUT: CASE Success
{
"status": "complete",
"errorFounds": []
}
OUTPUT: CASE Fail
CASE if YourFuntionNameTarget is missing in s3 LambdaFunctions.json
errorFounds return functionName
{
"status": "error",
"errorFounds": ["YourFuntionNameTarget"]
}
CASE LambdaFunctions.json is Missing in s3
{
"status": "error",
"errorFounds": ["LambdaFunctions.json not found"]
}
OUTPUT: CASE anyone is successful
{
"status": "complete",
"errorFounds": ["YourFuntionNameTarget1"]
}
AWSRMTestService
Description: This function invokes Lambda functions to clear caches for all functions within a service, initiating cold starts to ensure they reload the latest configurations. This enables efficient cache management and simultaneous updates across the entire service.
Parameters:
- serviceTag (string, required): Name of the ServiceTag.
{
"serviceTag": "YourServiceTagTarget"
}
OUTPUT: CASE Success
{
"status": "complete",
"errorFounds": []
}
OUTPUT: CASE Fail
CASE if YourFuntionNameTarget is missing in s3 LambdaFunctions.json
errorFounds return functionName
{
"status": "error",
"errorFounds": ["YourFuntionNameTarget"]
}
CASE LambdaFunctions.json is Missing in s3
{
"status": "error",
"errorFounds": ["LambdaFunctions.json not found"]
}
OUTPUT: CASE anyone is successful
S3 LambdaFunctions Found FunctionName: ["YourFuntionNameTarget1", "YourFuntionNameTarget2"]
if YourFuntionNameTarget1 is fail and YourFuntionNameTarget2 is Success
{
"status": "complete",
"errorFounds": ["YourFuntionNameTarget1"]
}
AWSRMTestServices
Description: This function invokes Lambda functions to clear caches for all functions within multiple services, initiating cold starts so they reload the latest configurations. This enables efficient cache management and simultaneous updates across all specified services.
Parameters:
- clearLambdaList (array of objects, required): List of services and their corresponding Lambda functions to invoke.
- serviceTag (array of strings, required): Names of the ServiceTags.
{
"clearLambdaList": {
"serviceTags": [
"YourServiceTagTarget1",
"YourServiceTagTarget2"
]
}
}
OUTPUT: CASE Success
{
"status": "complete",
"errorFounds": []
}
OUTPUT: CASE Fail
CASE YourServiceTagTarget1 & YourServiceTagTarget2 is missing LambdaFunctions.json
in s3
{
"status": "error",
"errorFounds": [
"LambdaFunctions not found for service tag: service1",
"LambdaFunctions not found for service tag: service2"
]
}
Error detected in the following functions:
* Function: YourFunctionNameTarget1 (Service: YourServiceTagTarget1)
* Function: YourFunctionNameTarget2 (Service: YourServiceTagTarget2)
{
"status": "error",
"errorFounds": ["ํYourFunctionNameTarget1", "YourFunctionNameTarget2"]
}
OUTPUT: CASE anyone is successful
Error detected in the following functions:
* Function: YourFunctionNameTarget1 (Service: YourServiceTagTarget1)
* Function: YourFunctionNameTarget2 (Service: YourServiceTagTarget2)
* if YourFuntionNameTarget1 is fail and YourFuntionNameTarget2 is Success
{
"status": "complete",
"errorFounds": ["YourFuntionNameTarget1"]
}
AWSRMTestAddAllRole
Description: This function is invoked without input. Upon invocation, it retrieves all roles from each service’s LambdaFunction.json
and adds them to the functions AWSRMTestFunction
, AWSRMTestFunctions
, AWSRMTestService
, and AWSRMTestServices
for cache clearing. This process ensures the necessary roles are granted to perform cache-clearing tasks effectively.
AWSRMTestAddAllRole
Description: This function is invoked without input. Upon invocation, it retrieves all roles from each service’s LambdaFunction.json
and adds them to the functions AWSRMTestFunction
, AWSRMTestFunctions
, AWSRMTestService
, and AWSRMTestServices
for cache clearing. This process ensures the necessary roles are granted to perform cache-clearing tasks effectively.
Parameters:
- clearLambdaList: (array of objects, required): Specifies which services to process for role addition.
- serviceTags (array of strings, required): Identifies the services from which roles will be added to
AWSRMTestFunction
,AWSRMTestFunctions
,AWSRMTestService
, andAWSRMTestServices
for cache-clearing capabilities.
- serviceTags (array of strings, required): Identifies the services from which roles will be added to
{
"clearLambdaList": {
"serviceTags": [
"YourServiceTagTarget1",
"YourServiceTagTarget2"
]
}
}
OUTPUT: CASE Success
{
"status": "complete",
"errorFounds": []
}
OUTPUT: CASE Fail
CASE Not Found LambdaFunctions.json
{
"status": "error",
"errorFounds": [
"LambdaFunctions.json not found for serviceTag: YourServiceTagTarget1",
"LambdaFunctions.json not found for serviceTag: YourServiceTagTarget2"
]
}
CASE Can't CleanCacha After AddRole
* Function: YourFunctionNameTarget1 (Service: YourServiceTagTarget1)
* Function: YourFunctionNameTarget2 (Service: YourServiceTagTarget2)
{
"status": "error",
"errorFounds": ["ํLambdaService.clearCacheAll failed"]
}
OUTPUT: CASE anyone is successful
CASE Found YourServiceTagTarget1 is not Found LambdaFunctions.json
{
"status": "complete",
"errorFounds": ["LambdaFunctions.json not found for serviceTag: YourServiceTagTarget1"]
}
Best Practices
- Validate Inputs: Always ensure that the input provided to the fambda and lambda functions is of the expected type and within acceptable ranges.
- Ensure that the
UploadSchemaHdrInv
function is invoked because the AWS Resource Management service requires a permission role and theLambdaFunctions.json
file to use the Lambda function.