Reputation: 694
Lambda function - Node.js
const AWS = require('aws-sdk')
exports.handler = async (event) => {
var appconfig = new AWS.AppConfig({ apiVersion: '2019-10-09' })
var params = {
ApplicationId: '6xeris1',
ConfigurationProfileId: '0ck2ijf'
}
const data = await appconfig.getConfigurationProfile(params).promise().catch(err => {
console.log(err)
})
if (data) {
console.log(data)
const response = {
statusCode: 200,
headers: {
'Access-Control-Allow-Headers': 'Content-Type',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'OPTIONS,POST,GET'
},
body: JSON.stringify(data)
}
return response
} else {
const response = {
statusCode: 500,
headers: {
'Access-Control-Allow-Headers': 'Content-Type',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'OPTIONS,POST,GET'
},
body: {}
}
return response
}
}
When getConfigurationProfile
is called there is no response. No data, no error and the function get timeout.
I added below inline policy to Lambda execution IAM role, but it didn't work.
"Action": "appconfig:*"
Anyone solved this issue before me? Thank you.
Upvotes: 5
Views: 5178
Reputation: 238209
Based on the comments.
The issue was due to the fact that lambda function was configure to be in a VPC. However, functions in VPC don't have internet access nor public IP. From docs:
Connecting a function to a public subnet doesn't give it internet access or a public IP address.
The solution was to use VPC endpoint.
Upvotes: 4