Specifying resource group name when creating resource group in aws cli - amazon-web-services

I'm trying to figure out how to specify a resource group name when creating resource groups via aws cli, when I look at the cli documentation for create-resource-group command I only see option to specify tags, how do you specify a name? , also I noticed when I access the console I don't see resource groups created using cli. Any ideas?

Related

How to Allow tags in instance metadata using Terraform AWS Provider

I'd like to enable/allow this AWS EC2 Instance Setting "Access to tags in instance metadata" using one of my Terraform's resources aws_launch_configuration OR aws_autoscaling_group.
I have tried to use this argument metadata_options of aws_launch_configuration resource but it did not work.
In addition find this GitHub Issue aws_launch_configuration add support for Instance Metadata Options #14621
How can I solve this issue?

CDK or CloudFormation resource for adding SSH key to IAM user?

I'm unable to locate in the docs how to specify an IAM user's public SSH key in AWS CDK and can't seem to find the corresponding CloudFormation type either. Terraform has the following:
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_user_ssh_key
How do I specify the key in either CloudFormation or CDK?
This is not supported. You would have to develop your own custom resource for that.

How to set instance name from cli

When logged in to the AWS EC2 Management Console, the list of instances has, as its first column, "Name" (followed by "Instance ID", etc).
For instances created through AWS CLI (using aws ec2 run-instances), the name field is empty. How can I set the name programmatically?
Also, is there any implication for giving it a name (e.g. does it have to be unique, and is the name used by something?) I would like to have it as a useful info, for managing my instances from the console.
By convention, the name that's displayed in the instance list is a resource tag with the Key Name and the name of your choice as its value.
You can do this via the AWS CLI using the --tag-specifications option as documented here:
aws ec2 run-instances [other options] --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=MyInstanceName}]'
Alternatively, you can also add tags, including the Name tag to existing resources using aws ec2 create-tag.

How to change AWS IAM group path?

IAM group path is a way to organize groups following an enterprise structure. Looking at the IAM Console I cannot find a way to set or modify the path of a group. Is it possible from the console or is there another way programmatically or through the CLI?
As far as I know, you must use the AWS cli or a programming language, e.g,
aws iam create-group --path "/company/team/project/" --group-name "your-group"
The groups are not listed in the Console in hierarchical form, but the ARN includes the path.
arn:aws:iam::111111111:group/company/team/project/your-group

Code deploy with Packer

I am creating an AWS AMI that is provisioned with Chef using Packer. At the creation of snapshots tags of the AWS AMI, I want it to be tagged with tags that assign it to be deployed with CodeDeploy:
{
"aws:autoscaling:groupName": "Env1"
}
In my JSON configuration for Packer, I am using snapshot_tags to define these.
The problem is that on creating the AMI, Packer fails with:
Build 'amazon-ebs' errored: Error adding tags to Resources ([]*string{(*string)(0xc420107170), (*string)(0xc420478758)}): InvalidParameterValue: Tag keys starting with 'aws:' are reserved for internal use
status code: 400, request id: fef34822-b692-4225-a2eb-a1cfac33a924
Cannot I use CodeDeploy with Packer since I must use aws in the tag?
ANSWER:
There is no need to use a tag for an AMI to deploy with CodeDeploy. My mistake.
Don't know about CodeDeploy, but you can never create a tag which starts with aws:.
Do not use the aws: prefix in your tag names or values because it is reserved for AWS use. You can't edit or delete tag names or values with this prefix. Tags with this prefix do not count against your tags per resource limit.
See AWS Docs: Using Tags - tag restrictions