Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
aws
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
aws
Commits
6a011731
Commit
6a011731
authored
Nov 29, 2024
by
Ahmad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inikt
parent
eec7b512
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
app.js
app.js
+14
-11
No files found.
app.js
View file @
6a011731
...
...
@@ -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:
'
,
er
r
.
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
(
err
or
)
{
console
.
error
(
'
Error
retrieving account email:
'
,
erro
r
.
message
);
throw
err
or
;
}
}
async
function
disableIpv6
(
lightsail
,
instanceName
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment