I'm trying to start an ec2 instance via the java sdk.I always want to get the 'latest' Windows Server 2019 ami. At the moment we hard code the image id. I can make a describe image request like below:
DescribeImagesRequest request = new DescribeImagesRequest().withFilters(new LinkedList<Filter>())
request.getFilters().add(new Filter().withName("name").withValues("Windows_Server-2019-English-Full-Base-2020.05.13"))
DescribeImagesResult describeImagesResult= getAmazonEc2Client().describeImages(request)
List<Image> images = describeImagesResult.getImages()
return images[0].getImageId()
Of course this returns one image id, because of the unique name. I effectively want to search for 'Windows_Server-2019-English-Full-Base' and then find the one that's latest. Searching in the UI returns 8 community images; 4 start with 'Windows_Server-2019-English-Full-Base' and provided by Amazon. How do I get all 8 back? (I can then wittle down to ones that start with 'Windows_Server-2019-English-Full-Base' and then sort by name to get latest one)
I tried searching for 'Windows_Server-2019-English-Full-Base' and 'Windows_Server-2019-English-Full-Base%' but both return 0 results via the api...
(Filter details are at https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/EC2/Types/DescribeImagesRequest.html)
To find the latest Windows Server AMI, you are better off using Parameter Store:
https://aws.amazon.com/blogs/mt/query-for-the-latest-windows-ami-using-systems-manager-parameter-store/
Note you can also get the latest Amazon Linux AMI via similar methods:
https://aws.amazon.com/blogs/compute/query-for-the-latest-amazon-linux-ami-ids-using-aws-systems-manager-parameter-store/
Related
I'm having some trouble recovering from failures in attaching custom images to my sagemaker domain.
I first created a custom image according to here.
When I use sagemaker console to attach the image built with sm-docker, it appears to successfully "attach" in the domain's image list, but when inspecting the image in the console, it shows an error:
Value '' at 'appImageConfigName' failed to satisfy constraint: Member
must satisfy regular expression pattern
This occurs even when the repository or tag are comprised of only alphanumeric characters.
After obtaining this error, I deleted the repositories in ECR.
Since then, the domain fails to update and I am unable to launch any apps or attempt to attach additional images.
The first issue I would like to address is restoring functionality of my sagemaker domain so I can further troubleshoot the issue. I am unable to delete the domain because of this error, even when there are no users, apps, or custom images associated with the domain.
The second issue I would like to address is being able troubleshoot the appImageConfigName error.
Thanks!
While I was unable to delete the domain via console, I was able to delete it via cli.
I made aws auto deployment code with boto3 library.
In my code, get all service list and use it.
I have to get lastest service. But I think there is no order option.
(https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.list_services)
Sometimes, first element is latest service.
But sometimes, old service is placed in first element.
Is there any option or way to get latest service?
Thanks.
The list_services method does not return details of individual services. It simply lists the services, and returns you a list of identifiers (ARNs) for those services.
To get more details of a given service, you can use describe_services. This allows you to get details of up to 10 services at a time.
So, take the list of service identifiers that you get back from list_services, and pass it to describe_services (with at most 10 service identifiers). Something like this (untested):
list_response = client.list_services(
cluster='xyz',
launchType='EC2'
)
desc_response = client.describe_services(
cluster='xyz',
services=list_response['serviceArns']
)
Note that you will have to do pagination using maxResults / nextToken if there are a lot of results.
I am completely new to Amazon Web Services, however, I did get an account and I am able to browse our list of servers. I am trying to create a database backup programmatically using .NET. I have installed AWS for .NET and I have built and run the sample Empty console program.
I can see that I can create an instance of the RDS service with the following line:
AmazonRDS rds = AWSClientFactory.CreateAmazonRDSClient(RegionEndPoint.USEast1);
However, I notice that the rds.CreateDBSnapshot(); needs a request object but I don't see anything like CreateDBSnapshotRequest in the reference .dll, can anyone help with a working example?
Like you said CreateDBSnapshotRequest is the parameter you have to pass to this function.
CreateDBSnapshotRequest is defined in the Amazon.RDS.Model namespace within the AWSSDK.dll assembly (version 1.5.25.0)
Within CreateDBSnapshotRequest you must pass the the DB Instance Identifier (for example mydbinstance-1), that you defined when you invoked the CreateDBInstance (or one of it's related methods) and the identifier for the snapshot you wish to generate (example: my-snapshot-id) for this DB Instance.
edit / example
Well there are a couple ways to achieve this, here's one example - hope it clears up your doubts
using Amazon.RDS;
using Amazon.RDS.Model;
...
...
//gets the credentials from the default configuration
AmazonRDS rdsClient = AWSClientFactory.CreateAmazonRDSClient();
CreateDBSnapshotRequest dbSnapshotRequest = new CreateDBSnapshotRequest();
dbSnapshotRequest.DBInstanceIdentifier = "my-oracle-instance";
dbSnapshotRequest.DBSnapshotIdentifier = "daily-snapshot";
rdsClient.CreateDBSnapshot(dbSnapshotRequest);
Dont't forget that the DB Instance (in the example my-oracle-instance) must exist (duh :) and must be in the available state, like this:
How can I programmatically dump/query Launch Services database in MacOS (i.e. analog of command lsregister -dump)?
EDIT: I want to get set of associations UTI -> Bundle_IDs. Using LSCopyAllRoleHandlersForContentType - does not always work, here a similar trouble, therefore concluded that the best working method - parsing the output of "lsregister -dump", but the location of lsregister changes from version to version.
Is it possible to find all the new Amazon products in a specific category using the Amazon Associates Web Service or any other tool ?
I tried also the RSS which give only 10 results and it is updated only once in few months. Do you have any other ideas ?
Once you know the Browse Node for the category you're interested in, you can use the BrowseNodeLookup operation with the NewReleases ResponseGroup to get some new products in that category; looks like you get 10, even in a busy category like Music ยป Alternative.
They don't say anything in those pages about getting more, and NewReleases is only a valid ResponseGroup for BrowseNodeLookup operations and not, say, ItemSearch, so I don't think you can get more than 10 new releases per category.