Published
Edited
Oct 29, 2021
9 forks
2 stars
Insert cell
Insert cell
region = "us-east-1"
Insert cell
Inputs.table(instances, {
columns: ["InstanceId", "KeyName", "InstanceType", "State", "LaunchTime"],
format: {
State: (d) => d.Name,
InstanceId: (d) => html`<a href="https://console.aws.amazon.com/ec2/v2/home?region=${region}#InstanceDetails:instanceId=${d}">${d}</a>`,
}
})
Insert cell
// Either load the bucket contents or load the sample cached data
reservations = client
? (await client.send(new AWS.DescribeInstancesCommand({})))
: FileAttachment("reservations.json").json()
Insert cell
instances = reservations.Reservations.flatMap(d => d.Instances)
Insert cell
Insert cell
AWS = import("https://cdn.skypack.dev/@aws-sdk/client-ec2@3.39.0")
Insert cell
client = {
try {
return new AWS.EC2Client({
region,
credentials: {
accessKeyId: Secret("AWS_ACCESS_KEY_ID"),
secretAccessKey: Secret("AWS_SECRET_ACCESS_KEY")
}
})
} catch {
return false;
}
}
Insert cell
hasAccessKeyID = {
try {
Secret("AWS_ACCESS_KEY_ID");
return true;
} catch {
return false;
}
}
Insert cell
hasSecretAccessKey = {
try {
Secret("AWS_SECRET_ACCESS_KEY");
return true;
} catch {
return false;
}
}
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more