Commit 6a011731 authored by Ahmad's avatar Ahmad

inikt

parent eec7b512
......@@ -89,24 +89,27 @@ async function openAllPorts(lightsail, instanceName) {
});
}
async function getAccountId(credentials) {
// Initialize the AWS Organizations client
const organizations = new AWS.Organizations({
accessKeyId: credentials.accessKeyId,
secretAccessKey: credentials.secretAccessKey,
region: 'us-east-1', // AWS Organizations is a global service; specify any region
});
try {
const accounts = await organizations.listAccounts({}).promise();
const account = accounts.Accounts.find(acc => acc.Id === "585768167598"); // Replace with your account ID
if (account && account.Email) {
console.log('Account Email Retrieved:', account.Email);
return account.Email;
} else {
throw new Error('Email not found for the given account ID.');
}
} catch (err) {
console.error('Error fetching account email from Organizations:', err.message);
throw err;
// List all accounts in the organization
const data = await organizations.listAccounts().promise();
// Find the account with the matching account ID
console.log(data.Accounts)
// const account = data.Accounts.find(acc => acc.Id === targetAccountId);
} catch (error) {
console.error('Error retrieving account email:', error.message);
throw error;
}
}
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