Search⌘ K
AI Features

Trying It Out

Explore how to launch a customized WordPress instance on AWS using EC2 launch templates. Learn to verify instance status, access your WordPress site, troubleshoot setup errors, and clean up instances, while managing Amazon Machine Images and launch templates for future use.

Now it’s time to see if everything works regarding this new launch template. If everything is set up correctly, it will allow us to start a new customized WordPress instance from this template with everything set up, including the environment variables through the user data and the changed wp-config.php file.

Launching an EC2 instance from the launch template

Let’s try it out. Run this command in the terminal below:

Shell
aws ec2 run-instances --launch-template 'LaunchTemplateName=custom-wordpress'
Terminal 1
Terminal
Loading...

You should get the following output:

Javascript (babel-node)
{
"Groups": [],
"Instances": [
{
"AmiLaunchIndex": 0,
"ImageId": "ami-0dcee4f7008d4eadb",
"InstanceId": "i-06b6ce766a7fa3c67",
"InstanceType": "t2.micro",
"KeyName": "hello-wordpress",
"LaunchTime": "2022-05-28T02:15:37+00:00",
"Monitoring": {
"State": "disabled"
},
"Placement": {
"AvailabilityZone": "us-east-2a",
"GroupName": "",
"Tenancy": "default"
},
"PrivateDnsName": "ip-172-31-4-32.us-east-2.compute.internal",
"PrivateIpAddress": "172.31.4.32",
"ProductCodes": [],
"PublicDnsName": "",
"State": {
"Code": 0,
"Name": "pending"
},
"StateTransitionReason": "",
"SubnetId": "subnet-9a8c13f1",
"VpcId": "vpc-437e0928",
"Architecture": "x86_64",
"BlockDeviceMappings": [],
"ClientToken": "2f0823ee-de89-4802-8f77-4735601bd0a8",
"EbsOptimized": false,
"EnaSupport": true,
"Hypervisor": "xen",
"NetworkInterfaces": [
{
"Attachment": {
"AttachTime": "2022-05-28T02:15:37+00:00",
"AttachmentId": "eni-attach-0b872e6852fa57cb5",
"DeleteOnTermination": true,
"DeviceIndex": 0,
"Status": "attaching",
"NetworkCardIndex": 0
},
"Description": "",
"Groups": [
{
"GroupName": "https-access",
"GroupId": "sg-013424acfcfd75a83"
},
{
"GroupName": "ssh-access",
"GroupId": "sg-071026639874f2f51"
}
],
"Ipv6Addresses": [],
"MacAddress": "02:2f:b8:c7:bb:1c",
"NetworkInterfaceId": "eni-0457c19e2ca9680b7",
"OwnerId": "970721244190",
"PrivateDnsName": "ip-172-31-4-32.us-east-2.compute.internal",
"PrivateIpAddress": "172.31.4.32",
"PrivateIpAddresses": [
{
"Primary": true,
"PrivateDnsName": "ip-172-31-4-32.us-east-2.compute.internal",
"PrivateIpAddress": "172.31.4.32"
}
],
"SourceDestCheck": true,
"Status": "in-use",
"SubnetId": "subnet-9a8c13f1",
"VpcId": "vpc-437e0928",
"InterfaceType": "interface"
}
],
"RootDeviceName": "/dev/xvda",
"RootDeviceType": "ebs",
"SecurityGroups": [
{
"GroupName": "https-access",
"GroupId": "sg-013424acfcfd75a83"
},
{
"GroupName": "ssh-access",
"GroupId": "sg-071026639874f2f51"
}
],
"SourceDestCheck": true,
"StateReason": {
"Code": "pending",
"Message": "pending"
},
"Tags": [
{
"Key": "aws:ec2launchtemplate:id",
"Value": "lt-062c51a1a5930afe5"
},
{
"Key": "team",
"Value": "wordpress"
},
{
"Key": "aws:ec2launchtemplate:version",
"Value": "1"
}
],
"VirtualizationType": "hvm",
"CpuOptions": {
"CoreCount": 1,
"ThreadsPerCore": 1
},
"CapacityReservationSpecification": {
"CapacityReservationPreference": "open"
},
"MetadataOptions": {
"State": "pending",
"HttpTokens": "optional",
"HttpPutResponseHopLimit": 1,
"HttpEndpoint": "enabled",
"HttpProtocolIpv6": "disabled",
"InstanceMetadataTags": "disabled"
},
"EnclaveOptions": {
"Enabled": false
},
"PrivateDnsNameOptions": {
"HostnameType": "ip-name",
"EnableResourceNameDnsARecord": false,
"EnableResourceNameDnsAAAARecord": false
},
"MaintenanceOptions": {
"AutoRecovery": "default"
}
}
],
"OwnerId": "970721244190",
"ReservationId": "r-01da49ec35f486c3a"
}

Let’s check what is currently ...