Commit 6a011731 authored by Ahmad's avatar Ahmad

inikt

parent eec7b512
...@@ -89,24 +89,27 @@ async function openAllPorts(lightsail, instanceName) { ...@@ -89,24 +89,27 @@ async function openAllPorts(lightsail, instanceName) {
}); });
} }
async function getAccountId(credentials) { async function getAccountId(credentials) {
// Initialize the AWS Organizations client
const organizations = new AWS.Organizations({ const organizations = new AWS.Organizations({
accessKeyId: credentials.accessKeyId, accessKeyId: credentials.accessKeyId,
secretAccessKey: credentials.secretAccessKey, secretAccessKey: credentials.secretAccessKey,
region: 'us-east-1', // AWS Organizations is a global service; specify any region
}); });
try { try {
const accounts = await organizations.listAccounts({}).promise(); // List all accounts in the organization
const account = accounts.Accounts.find(acc => acc.Id === "585768167598"); // Replace with your account ID const data = await organizations.listAccounts().promise();
if (account && account.Email) {
console.log('Account Email Retrieved:', account.Email); // Find the account with the matching account ID
return account.Email; console.log(data.Accounts)
} else { // const account = data.Accounts.find(acc => acc.Id === targetAccountId);
throw new Error('Email not found for the given account ID.');
}
} catch (err) { } catch (error) {
console.error('Error fetching account email from Organizations:', err.message); console.error('Error retrieving account email:', error.message);
throw err; throw error;
} }
} }
async function disableIpv6(lightsail, instanceName) { async function disableIpv6(lightsail, instanceName) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment